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:
- init
- login
Any consumption and custom events - logout
Program Interfaces include Player Login, Payment Behavior Analysis, Custom Events.
Player Login
// login start
CAAccount.loginStart(
String channel // customer acquisition channel, refers to obtaining information about the client's advertising channels
);
// login successful
CAAccount.loginSuccess(
String uid, // user ID
int age, // age
int sex, // gender
String channel // customer acquisition channel, refers to obtaining information about the client's advertising channels
);
// login failed
CAAccount.loginFailed(
String reason // cause of login failure
);
// logout (We have considered and improved the abnormal logout operation of players)
CAAccount.logout();
Payment Behavior Analysis
Not an actual payment channel. Only used to collect payment behavior.
// payment start
CAPayment.payBegin(
int amount, // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
String orderID, // Order ID, which uniquely identifies a transaction.
String payType, // Payment methods, such as: Alipay, Apple IAP, UnionPay, Aibe payment aggregation, etc.
String iapID, // Item ID. The type of topping up package purchased by the player. For example: RMB 15 yuan for a package of 600 virtual currencies.
String currencyType, // Topping up currency type. Use the 3-digit alphanumeric code specified in ISO 4217 to mark currency types.
String virtualCurrencyAmount, // The amount of virtual currency obtained by topping up.
String accountID, // consumer account. Apple is AppleID, Android is Google Advertising ID, etc.
String partner, // payment channel
String gameServer, // The server where the player tops up.
String level, // The level at which the player tops up.
String mission // The level or mission where the player tops up. You can also input a player's highest level.
)
// payment successful
CAPayment.paySuccess(
int amount, // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
String orderID,
String payType,
String iapID,
String currencyType,
String virtualCurrencyAmount,
String accountID,
String partner,
String gameServer,
String level,
String mission
);
// payment failed
CAPayment.payFailed(
int amount, // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
String orderID,
String payType,
String iapID,
String currencyType,
String virtualCurrencyAmount,
String accountID,
String partner,
String gameServer,
String level,
String mission,
String reason // cause of payment failure
);
// payment canceled
CAPayment.payCanceled(
int amount, // Amount of cash or cash equivalent. For example, input 100 for 1 yuan, and input 10,000 for 100 yuan.
String orderID,
String payType,
String iapID,
String currencyType,
String virtualCurrencyAmount,
String accountID,
String partner,
String gameServer,
String level,
String mission
);
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.
The background performs related statistics and funnel analysis based on the tags defined in the event:
// event start
CACustomEvent.onStarted(
final String eventID, // event ID
JSONObject eventData // custom data(JSONObject)
);
// event completed
CACustomEvent.onSuccess(
final String eventID,
JSONObject eventData
);
// event canceled
CACustomEvent.onCancelled(
final String eventID,
JSONObject eventData
);
// event failed
CACustomEvent.onFailed(
final String eventID,
JSONObject eventData,
String reason // cause of failure
);