Program Interfaces

Attention: Only when the logout method is called can there be indicators such as game duration and active users. The core design of a complete session link has three steps:

  1. init
  2. login
    Any consumption and custom events
  3. logout

Program Interfaces include Player Login, Payment Behavior Analysis, Custom Events.

Player Login

This interface needs to be called after initialization.

// login start
cocosAnalytics.CAAccount.loginStart({
    channel: '99999',   // customer acquisition channel, refers to obtaining information about the client's advertising channels   
});

// login successful
cocosAnalytics.CAAccount.loginSuccess({
    userID: 'dddddddd',
    age: 1,             // age
    sex: 1,             // gender: 1 is male, 2 is female, other is unknown
    channel: '99999',   // customer acquisition channel, refers to obtaining information about the client's advertising channels   
})

// login failed
cocosAnalytics.CAAccount.loginFailed({
    reason: 'wrong password' // the cause of failure
})

// logout (We have considered and improved the abnormal logout operation of players)
cocosAnalytics.CAAccount.logout()

Payment Behavior Analysis

Not an actual payment channel. Only used to collect payment behavior.

        info.amount,
        info.orderID,
        info.payType,
        info.iapID,
        info.currencyType,
        info.virtualCurrencyAmount || "0",
        info.accountID || "",
        info.partner || "",
        info.gameServer || "",
        info.level || "0",
        info.mission || ""
// payment start
cocosAnalytics.CAPayment.payBegin({
    amount:100,                 // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
    orderID:'od10001000111',    // Order ID, which uniquely identifies a transaction.
    payType:'Alipay',            // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
    iapID:'spree',          // Item ID. The type of topping up package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies
    currencyType:'CNY',         // Topping up currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types.
    virtualCurrencyAmount:1000, // The amount of virtual currency obtained by topping up.
    accountID:'user1001',       // consumer account. Apple is AppleID, Android is Google Advertising ID, etc.
    partner:'',                 // account channel name, such as QQ, WeChat
    gameServer:'Ionia',       // The server where the player tops up.
    level:10,                   // The level at which the player tops up.
    mission:'level 10'             // The level or mission where the player tops up. You can also input a player's highest level.
})

// payment successful
cocosAnalytics.CAPayment.paySuccess({
    amount:100,                 // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
    orderID:'od10001000111',    // Order ID, which uniquely identifies a transaction.
    payType:'Alipay',            // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
    iapID:'spree',          //  Item ID. The type of topping up package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies.
    currencyType:'CNY',         // Top up currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types.
    virtualCurrencyAmount:1000, // The amount of virtual currency obtained by topping up.
    accountID:'user1001',       // Consumer account. Apple is AppleID, Android is Google Advertising ID, etc.
    partner:'',                 // Account channel name, such as QQ, WeChat
    gameServer:'Ionia',       //  The server where the player tops up.
    level:10,                   // The level at which the player tops up.
    mission:'level 10'             // The level or mission where the player tops up. You can also input a player's highest level.
})

// payment failed
cocosAnalytics.CAPayment.payFailed({
    amount:100,                 // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
    orderID:'od10001000111',    // Order ID, which uniquely identifies a transaction.
    payType:'Alipay',            // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
    iapID:'spree',          // Item ID. The type of recharge package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies.
    currencyType:'CNY',         // Recharge currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types.
    virtualCurrencyAmount:1000, // The amount of virtual currency obtained by topping up.
    accountID:'user1001',       // consumer account. Apple is AppleID, Android is Google Advertising ID, etc. 
    partner:'',                 // Account channel name, such as QQ, WeChat
    gameServer:'Ionia',        // The server where the player tops up.
    level:10,                   // The level at which the player tops up.
    mission:'level 10',            // The level or mission where the player tops up. You can also input a player's highest level.
    reason:'hero died'            // the cause of topping up failure
})

// payment canceled
cocosAnalytics.CAPayment.payCanceled({
    amount:100,                 // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
    orderID:'od10001000111',    // Order ID, which uniquely identifies a transaction.
    payType:'Alipay',            // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
    iapID:'spree',          // Item ID. The type of topping up package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies.
    currencyType:'CNY',         // Topping up currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types.
    virtualCurrencyAmount:1000, // The amount of virtual currency obtained by topping up.
    accountID:'user1001',       // consumer account. Apple is AppleID, Android is Google Advertising ID, etc.
    partner:'',                 // Account channel name, such as QQ, WeChat
    gameServer:'Ionia',       // The server where the player tops up.
    level:10,                   // The level at which the player tops up.
    mission:'level 10'            // The level or mission where the player tops up. You can also input a player's highest level.
})

Custom Events

The event ID can be filled in arbitrarily, and the event content and label can be customized. E.g:

"evetID":"barrier",
"eventValue":{
        "number of the level" : "magic bottle",
        "player level" : "100",
        "player power" : 100,
        "resurrection times" : 100,
        }

Length Limit: eventid (event ID) 200;tagkey (tag ID) 200; tagvalue (tag value) 200.

In the example above: barrier is eventID; number of levels is the tagkey; magic bottle is the tagvalue.

Custom events have built-in default templates, including player information, levels, missions (tasks), items, etc. Attention: Event ID cannot use keywords like: init, pay, task, barrier, item, advertising, role, virtual, to avoid confusion with the data of default templates.

// event start
// parameter: event ID (required), No more than 30 characters.
// parameter: event content (required)
cocosAnalytics.CACustomEvent.onStarted("event ID", {
    name: "event ID",
    player1: 1,
    player2: 1
});
// event completed
// parameter: event ID (required), no more than 30 characters.
cocosAnalytics.CACustomEvent.onSuccess("event ID", {
    name: "event ID",
    player1: 1,
    player2: 1
});
// event canceled
// parameter: event ID (required), no more than 30 characters.
cocosAnalytics.CACustomEvent.onCancelled("event ID", {
    name: "assault",
    player1: 1,
    player2: 1
});
// event failed
// parameter: event ID (required), no more than 30 characters.
cocosAnalytics.CACustomEvent.onFailed("event ID", {
    name: "assault",
    player1: 1,
    player2: 1
}, "battle abnormal");

results matching ""

    No results matching ""