增加数据打点

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) {
return sdkManage.updateUser(allInfo);
}
log(eventName, param) {
setTimeout(function() {
sdkManage.uploadLog(eventName, param);
});
}
}
</script>

View File

@ -1,7 +1,7 @@
const env = 'test'; //product, test
export default {
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/',
version: '1.0.0',
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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