本插件下载地址:
https://ext.dcloud.net.cn/plugin?id=4750
极光·Janalytics极光统计插件
极光官方合作发布·极光统计插件·极光统计Janalytics统计sdk
极光统计插件使用该插件的时候,请配合使用 JCore 基础插件包 ,JCore基础插件包地址:
https://ext.dcloud.net.cn/plugin?id=4752
使用方法:
打包的时候勾选云插件
调用方法:
<template>
<view>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="initCrashHandler()">initCrashHandler</button>
<button @tap="stopCrashHandler()">stopCrashHandler</button>
<button @tap="setChannel()">setChannel</button>
<button @tap="onCountEvent()">onCountEvent</button>
<button @tap="onCalculateEvent()">onCalculateEvent</button>
<button @tap="onLoginEvent()">onLoginEvent</button>
<button @tap="onRegisterEvent()">onRegisterEvent</button>
<button @tap="onBrowseEvent()">onBrowseEvent</button>
<button @tap="onPurchaseEvent()">onPurchaseEvent</button>
<button @tap="setAnalyticsReportPeriod()">setAnalyticsReportPeriod</button>
</view>
</view>
</template>
<script>
const Janalytics = uni.requireNativePlugin('youyacao-Janalytics');
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
setAnalyticsReportPeriod()
{
Janalytics.setAnalyticsReportPeriod({
period:10 //上报周期 10秒
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
initCrashHandler()
{
Janalytics.initCrashHandler({ }, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
stopCrashHandler()
{
Janalytics.stopCrashHandler({ }, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
setChannel()
{
Janalytics.setChannel({
channel:"channel"
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onCountEvent()
{
Janalytics.onCountEvent({
eventId:"wwww",
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onCalculateEvent()
{
Janalytics.onCalculateEvent({
eventId:"qqqq",
eventValue:1,
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onLoginEvent()
{
Janalytics.onLoginEvent({
loginMethod:"qq",
loginSuccess:true,
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onRegisterEvent()
{
Janalytics.onRegisterEvent({
registerMethod:"sina",
registerSuccess:true,
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onBrowseEvent()
{
Janalytics.onBrowseEvent({
browseId:"browse_id",
browseName:"深圳热点新闻",
browseType:"news",
browseDuration:30, //秒
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
onPurchaseEvent()
{
Janalytics.onPurchaseEvent({
purchaseGoodsid:"goodsId",
purchaseGoodsName:"篮球",
purchasePrice:300 ,//
purchaseSuccess:true,
purchaseCurrency:"CNY" , // CNY USD
purchaseGoodsType:"sport",
purchaseGoodsCount:1,
eventObj:[
{"objname1":"objvalue1"},
{"objname2":"objvalue2"}
]
}, result => {
const msg = JSON.stringify(result);
uni.showModal({
content: msg,
showCancel: false
});
});
},
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200upx;
width: 200upx;
margin-top: 200upx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50upx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36upx;
color: #8f8f94;
}
</style>