Default Templates
The default template is intended to be compatible with the old version of interfaces. It is recommended that users use the Custom Event service interface to send according to their needs.
Player Information
// set account type
cocosAnalytics.CAAccount.setAccountType('VIP1')
// age
cocosAnalytics.CAAccount.setAge(26)
// gender: 1 is male, 2 is female, other is unknown
cocosAnalytics.CAAccount.setGender(1)
// character creation
cocosAnalytics.CAAccount.createRole({
roleID:'a1005', // character ID
userName:'I can fire fireballs', // username
race:'human', // character race
class:'mage', // character class
gameServer : "server 1" // current server
})
// player level
cocosAnalytics.CAAccount.setLevel(1)
Levels
// level start
cocosAnalytics.CALevels.begin({
level : "Level1" // level name
})
// level completed
cocosAnalytics.CALevels.complete({
level : "Level1" // level name
})
// level failed
cocosAnalytics.CALevels.failed({
level : "Level1", // level name
reason : "character died" // the cause of failure
})
Missions
Mission Type | Description |
---|---|
cocosAnalytics.CATaskType.GuideLine | Tutorial Mission |
cocosAnalytics.CATaskType.MainLine | Main Mission |
cocosAnalytics.CATaskType.BranchLine | Side Mission |
cocosAnalytics.CATaskType.Daily | Daily Mission |
cocosAnalytics.CATaskType.Activity | Activity |
cocosAnalytics.CATaskType.Other | Other Missions, Default |
// mission start
cocosAnalytics.CATask.begin({
taskID : "save the little girl", // mission name
type : cocosAnalytics.CATaskType.BranchLine // mission type
})
// mission completed
cocosAnalytics.CATask.complete({
taskID : "save the little girl"
})
// mission failed
cocosAnalytics.CATask.failed({
taskID : "save the little girl"
reason : "time out" // the cause of failure
})
Items
// item purchase
cocosAnalytics.CAItem.buy({
itemID : "magic bottle", // item ID
itemType : "magic power potion", // item type
itemCount : 11, // item amount
virtualCoin : 121, // virtual currency used
virtualType : "gold", // virtual currency type
consumePoint : "20" // virtual currency purchased
})
// item acquisition
cocosAnalytics.CAItem.get({
itemID : "magic bottle", // item ID
itemType : "magic power potion", // item type
itemCount : 11, // item ccount
reason : "mission rewards" // the way to obtain
})
// item consumption
cocosAnalytics.CAItem.consume({
itemID : "magic bottle", // item ID
itemType : "magic power potion", // item type
itemCount : 11, // item count
reason: "" // the way to consume
))
Virtual Currencies
// Set the total amount of virtual currency retention
cocosAnalytics.CAVirtual.setVirtualNum({
type : "gold", //virtual currency type, string, "diamond", "gold"
count : 123 //virtual currency amount, long type
})
// virtual currency acquisition
cocosAnalytics.CAVirtual.get({
type : "diamond", //virtual currency type, string, "diamond", "gold"
count : 112, //purchase amount, int number,
reason : "fight against monsters" //the reason of acquisition, string
})
// virtual currency consumption
cocosAnalytics.CAVirtual.consume({
type : "gold", //virtual currency type, string, "diamond", "gold"
count : 121111, //purchase amount, int number,
reason : "shopping" //the reason of consumption, string
})
Advertisements
// advertising start (ad ID)
cocosAnalytics.CAAdvertising.begin({
adID : "15 minutes of ads",
}))
// advertising completed
cocosAnalytics.CAAdvertising.complete({
adID : "15 minutes of ads",
timeLong: 15*60,
profit: "10 diamonds"
})
// advertising failed
cocosAnalytics.CAAdvertising.failed({
adID : "15 minutes of ads",
reason : "ad canceled"
})