增加数据打点

This commit is contained in:
zhl 2019-03-22 16:09:00 +08:00
parent f0ecb84319
commit 447a903f2a
10 changed files with 59 additions and 5 deletions

View File

@ -210,5 +210,10 @@ export default class extends wepy.app {
updateUserInfo(allInfo) { updateUserInfo(allInfo) {
return sdkManage.updateUser(allInfo); return sdkManage.updateUser(allInfo);
} }
log(eventName, param) {
setTimeout(function() {
sdkManage.uploadLog(eventName, param);
});
}
} }
</script> </script>

View File

@ -1,7 +1,7 @@
const env = 'test'; //product, test const env = 'test'; //product, test
export default { export default {
env: env, env: env,
apiBase: env === 'test'? 'https://ghost-test.kingsome.cn' : 'https://ghost.kingsome.cn', apiBase: env === 'test'? 'http://192.168.100.228' : 'https://ghost.kingsome.cn',
cdnBase: 'https://h5games-al.kingsome.cn/emulator-static/', cdnBase: 'https://h5games-al.kingsome.cn/emulator-static/',
version: '1.0.0', version: '1.0.0',
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演', gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',

View File

@ -58,6 +58,7 @@
app-id="wx815bf59d472c0a63" app-id="wx815bf59d472c0a63"
path="/pages/product?{{config.params}}" path="/pages/product?{{config.params}}"
extra-data="" extra-data=""
@tap = 'buyProductTap'
version="{{config.payVer}}" version="{{config.payVer}}"
>促销开通(购买产品后自动开通游戏)</navigator> >促销开通(购买产品后自动开通游戏)</navigator>
@ -85,6 +86,9 @@
}, },
goldTap(e) { goldTap(e) {
this.$emit('goldTap') this.$emit('goldTap')
},
buyProductTap(e) {
this.$emit('buyProductTap');
} }
} }
} }

View File

@ -210,8 +210,10 @@ var SDKManage = function() {
reject(err); reject(err);
}) })
}) })
}; };
this.uploadLog = function(eventName, param) {
jcfw.gamelog.logButtonClick(eventName, param);
}
}; };

View File

@ -48,6 +48,7 @@
}; };
onLoad(params) { onLoad(params) {
this.$parent.log('game_play_page_onload', params);
this.gid = params.gid; this.gid = params.gid;
this.link = decodeURIComponent(params.link); this.link = decodeURIComponent(params.link);
let account = wepy.getStorageSync('account'); let account = wepy.getStorageSync('account');
@ -82,11 +83,13 @@
let shareImg = this.share_image; let shareImg = this.share_image;
let url = `/pages/index?isShare=1&inviter_id=${account.account_id}`; let url = `/pages/index?isShare=1&inviter_id=${account.account_id}`;
if (this.roomId) { if (this.roomId) {
this.$parent.log('create_room', {gid: this.gid, roomId: this.roomId});
url = `/pages/index?isShare=1&inviter_id=${account.account_id}&roomId=${this.roomId}&gid=${this.gid}&togame=1&t=${Date.now()}`; url = `/pages/index?isShare=1&inviter_id=${account.account_id}&roomId=${this.roomId}&gid=${this.gid}&togame=1&t=${Date.now()}`;
} else { } else {
let shareObj = this.$getShareCfg(); let shareObj = this.$getShareCfg();
shareStr = shareObj.str; shareStr = shareObj.str;
shareImg = shareObj.image shareImg = shareObj.image
this.$parent.log('onShareAppMessage', {page: 'game', gid: this.gid, shareUrl: url});
} }
return { return {
title: shareStr, title: shareStr,

View File

@ -54,7 +54,7 @@
</view> </view>
<gameBottomBar class="{{showAll? '' : 'hidden'}}" :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap" <gameBottomBar class="{{showAll? '' : 'hidden'}}" :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap"
@bottomSecondTap.user="bottomSecondTap"/> @bottomSecondTap.user="bottomSecondTap"/>
<zActionSheet :config.sync="zActionSheetCfg" @cancelTap.user="actionSheetCancel" @goldTap.user="actionSheetGold"/> <zActionSheet :config.sync="zActionSheetCfg" @cancelTap.user="actionSheetCancel" @buyProductTap.user="buyProductTap" @goldTap.user="actionSheetGold"/>
</template> </template>
<script> <script>
@ -119,6 +119,7 @@
bottomMainTap(e) { bottomMainTap(e) {
console.log('bottomMainTap'); console.log('bottomMainTap');
if (this.record.owned || this.vip) { if (this.record.owned || this.vip) {
this.$parent.log('play_game_btn', {gid: this.record.gid});
if (this.record.category === 'fc') { if (this.record.category === 'fc') {
this.openPlayMenu(); this.openPlayMenu();
} else { } else {
@ -126,12 +127,14 @@
} }
} else { } else {
//显示购买游戏界面 //显示购买游戏界面
this.$parent.log('buy_game_btn', {gid: this.record.gid});
this.showBuyMenu(); this.showBuyMenu();
} }
}, },
bottomSecondTap(e) { bottomSecondTap(e) {
console.log('bottomSecondTap'); console.log('bottomSecondTap');
this.$parent.log('get_coin_btn', {gid: this.record.gid});
this.requestAd(''); this.requestAd('');
}, },
toggleShowMore() { toggleShowMore() {
@ -146,10 +149,15 @@
} else { } else {
this.buyGame(); this.buyGame();
} }
this.$parent.log('gold_buy_game', {gid: this.record.gid});
},
buyProductTap() {
this.$parent.log('buy_product_btn', {gid: this.record.gid});
} }
}; };
onLoad(params) { onLoad(params) {
this.$parent.log('gameInfo', params);
this.zActionSheetCfg.payVer = g.env === 'product' ? 'release' : 'develop'; this.zActionSheetCfg.payVer = g.env === 'product' ? 'release' : 'develop';
this.vip = this.$parent.isVip(); this.vip = this.$parent.isVip();
this.id = decodeURIComponent(params.id); this.id = decodeURIComponent(params.id);
@ -174,6 +182,7 @@
content: '购买成功', content: '购买成功',
showCancel: false showCancel: false
}); });
this.$parent.log('buy_game_success', {gid: this.record.gid, type: 'money'});
self.zActionSheetCfg.hide = true; self.zActionSheetCfg.hide = true;
self.record.owned = true; self.record.owned = true;
self.bottomActionCfg.mainBtnIconClass = 'icon-merge'; self.bottomActionCfg.mainBtnIconClass = 'icon-merge';
@ -183,6 +192,7 @@
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id}); jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id});
} else { } else {
this.showTopTips('开通失败') this.showTopTips('开通失败')
this.$parent.log('buy_game_fail', {gid: this.record.gid, type: 'money'});
} }
self.$apply(); self.$apply();
}); });
@ -229,6 +239,7 @@
url = `${this.gbaUrl2}?id=${this.id}`; url = `${this.gbaUrl2}?id=${this.id}`;
} }
} }
this.$parent.log('play_game', {gid: this.id, multip: multip});
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/game?link=' + encodeURIComponent(url) + '&gid=' + this.id url: '/pages/game?link=' + encodeURIComponent(url) + '&gid=' + this.id
+ '&name=' + encodeURIComponent(this.record.name) + '&name=' + encodeURIComponent(this.record.name)
@ -251,10 +262,12 @@
this.$apply(); this.$apply();
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: this.id}); jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: this.id});
this.getRecord(); this.getRecord();
this.$parent.log('buy_game_success', {gid: this.id, type: 'score'});
} }
} catch (err) { } catch (err) {
console.log('buy game error'); console.log('buy game error');
this.showTopTips('开通失败') this.showTopTips('开通失败')
this.$parent.log('buy_game_fail', {gid: this.id, type: 'score'});
} }
} }
async getRecord() { async getRecord() {
@ -339,9 +352,11 @@
let self = this; let self = this;
let account = wepy.getStorageSync('account'); let account = wepy.getStorageSync('account');
let shareObj = this.$getShareCfg(); let shareObj = this.$getShareCfg();
const shareUrl = `/pages/index?isShare=1&inviter_id=${account.account_id}`
this.$parent.log('onShareAppMessage', {page: 'gameInfo', shareUrl: shareUrl});
return { return {
title: shareObj.str, title: shareObj.str,
path: `/pages/index?isShare=1&inviter_id=${account.account_id}`, path: shareUrl,
imageUrl: shareObj.image, imageUrl: shareObj.image,
success: function (res) { success: function (res) {
wepy.getShareInfo({ wepy.getShareInfo({

View File

@ -21,6 +21,7 @@
app-id="wx815bf59d472c0a63" app-id="wx815bf59d472c0a63"
path="/pages/buyvip?{{vip_params}}" path="/pages/buyvip?{{vip_params}}"
extra-data="" extra-data=""
@tap = 'vipBtnTap'
version="{{payVer}}" version="{{payVer}}"
> >
{{vip_btn_title}}</navigator> {{vip_btn_title}}</navigator>
@ -110,6 +111,7 @@
methods = { methods = {
gameTap(gid, e) { gameTap(gid, e) {
this.$parent.log('game_tap', {gid: gid});
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/gameInfo?id=' + gid url: '/pages/gameInfo?id=' + gid
}) })
@ -123,6 +125,7 @@
await this.updateInviteViewData(); await this.updateInviteViewData();
this.inviteViewCfg.hide = false; this.inviteViewCfg.hide = false;
this.$apply(); this.$apply();
this.$parent.log('show_invite_btn', {});
}, },
hideInviteView() { hideInviteView() {
this.inviteViewCfg.hide = true; this.inviteViewCfg.hide = true;
@ -131,6 +134,10 @@
inviteBtnClick(index) { inviteBtnClick(index) {
console.log(`invite btn clicked: ${index}`); console.log(`invite btn clicked: ${index}`);
this.getRandomGame(); this.getRandomGame();
this.$parent.log('get_random_btn', {});
},
vipBtnTap() {
this.$parent.log('buy_vip_btn', {});
} }
}; };
onPullDownRefresh() { onPullDownRefresh() {
@ -150,6 +157,7 @@
} }
async onLoad(options) { async onLoad(options) {
this.$parent.log('index_onload', options);
let self = this; let self = this;
wepy.showShareMenu({ wepy.showShareMenu({
withShareTicket: true withShareTicket: true
@ -192,8 +200,10 @@
showCancel: false showCancel: false
}); });
this.getUserInfo(); this.getUserInfo();
this.$parent.log('buy_vip_success', data);
} else { } else {
this.showTopTips('购买失败') this.showTopTips('购买失败')
this.$parent.log('buy_vip_fail', data);
} }
}) })
/** /**
@ -206,12 +216,14 @@
let now = Date.now(); let now = Date.now();
if (now - timestamp > 60*1000*5) { if (now - timestamp > 60*1000*5) {
this.showTopTips('加入房间失败') this.showTopTips('加入房间失败')
this.$parent.log('join_room_fail', {reason: 'timeout'});
} else { } else {
let cfg = wepy.getStorageSync('cfg'); let cfg = wepy.getStorageSync('cfg');
let fcUrl = cfg.fcurl; let fcUrl = cfg.fcurl;
let roomId = options.roomId; let roomId = options.roomId;
let gid = options.gid; let gid = options.gid;
let link = `${fcUrl}?id=${gid}&roomId=${roomId}`; let link = `${fcUrl}?id=${gid}&roomId=${roomId}`;
this.$parent.log('join_room_success', {gid,roomId});
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/game?link=' + encodeURIComponent(link) + '&gid=' + gid +'&name=multiplayer' url: '/pages/game?link=' + encodeURIComponent(link) + '&gid=' + gid +'&name=multiplayer'
}); });
@ -233,6 +245,7 @@
jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this); jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
} }
onShow() { onShow() {
this.$parent.log('index_onshow', {});
let cfg = wepy.getStorageSync('cfg'); let cfg = wepy.getStorageSync('cfg');
if (!cfg._getrewardtype) { if (!cfg._getrewardtype) {
wepy.hideShareMenu(); wepy.hideShareMenu();
@ -421,6 +434,7 @@
if (this.achivement) { if (this.achivement) {
shareUrl += '&shareType=achivement' shareUrl += '&shareType=achivement'
} }
this.$parent.log('onShareAppMessage', {page: 'index', shareUrl: shareUrl});
return { return {
title: shareObj.str, title: shareObj.str,
path: shareUrl, path: shareUrl,

View File

@ -70,6 +70,7 @@
app-id="wxc02bad35ad26165e" app-id="wxc02bad35ad26165e"
path="?aid={{aid}}&version={{env}}&share_count={{shareCount}}" path="?aid={{aid}}&version={{env}}&share_count={{shareCount}}"
extra-data="" extra-data=""
@tap = 'jumpconfirm'
version="release" version="release"
> >
领取金币 领取金币
@ -103,10 +104,15 @@
methods = { methods = {
cancel: function() { cancel: function() {
wepy.navigateBack() wepy.navigateBack()
this.$parent.log('jump_page_cancel', {target: 'wxc02bad35ad26165e'});
},
jumpconfirm: function() {
this.$parent.log('jump_page_confirm', {target: 'wxc02bad35ad26165e'});
} }
}; };
async onLoad(params) { async onLoad(params) {
this.$parent.log('jump_page_onload', params);
this.env = g.env; this.env = g.env;
this.text = decodeURIComponent(params.text); this.text = decodeURIComponent(params.text);
this.aid = decodeURIComponent(params.aid); this.aid = decodeURIComponent(params.aid);

View File

@ -59,6 +59,7 @@
onLoad() { onLoad() {
console.log('login onLoad'); console.log('login onLoad');
this.$parent.log('login_page_onload', {});
} }
} }
</script> </script>

View File

@ -126,6 +126,7 @@
this.getRecords(); this.getRecords();
}, },
gameTap(gid, e) { gameTap(gid, e) {
this.$parent.log('search_game_tap', {gid: gid});
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/gameInfo?id=' + gid url: '/pages/gameInfo?id=' + gid
}) })
@ -149,6 +150,7 @@
} }
async onLoad(options) { async onLoad(options) {
this.$parent.log('search_page_onload', options);
this.getRecords(); this.getRecords();
this.typeArr.unshift('所有类型') this.typeArr.unshift('所有类型')
let self = this; let self = this;
@ -232,9 +234,11 @@
onShareAppMessage() { onShareAppMessage() {
let account = wepy.getStorageSync('account'); let account = wepy.getStorageSync('account');
let shareObj = this.$getShareCfg(); let shareObj = this.$getShareCfg();
const shareUrl = `/pages/index?isShare=1&inviter_id=${account.account_id}`
this.$parent.log('onShareAppMessage', {page: 'search', shareUrl: shareUrl});
return { return {
title: shareObj.str, title: shareObj.str,
path: `/pages/index?isShare=1&inviter_id=${account.account_id}`, path: shareUrl,
imageUrl: shareObj.image, imageUrl: shareObj.image,
success: function (res) { success: function (res) {
wepy.getShareInfo({ wepy.getShareInfo({