# Mini Program/Mini Game SDK User Guide
TIP
Before accessing, please read the preparation before accessing .
You can get the source code of Mini Program/Mini Game SDK in GitHub (opens new window).
If you use game engines to develop small games, please read the integration schemes of common game engines: Egret Engine , LayaAir , CocosCreator .
**The latest version is: **2.0. 2
**Updated: **2021-1 2 - 31
**Download address **: Mini Program (opens new window), Mini Games (opens new window)
Mini Program/Mini Game SDK provides a set of standard API interfaces for common Mini Program platforms, fast applications, and small game platforms to realize data reporting functions. Currently, the supported platforms and corresponding files are as follows:
Mini Program:
- WeChat Mini Program: thinkingdata.wx.min.js
- Baidu Mini Program: thinkingdata.swan.min.js
- ByteDance Mini Program: thinkingdata.tt.min.js
- Alipay Mini Program: thinkingdata.my.min.js
- DingTalk Mini Program: thinkingdata.dd.min.js
- Kuaishou Mini Program: thinkingdata.ks.min.js
- Fast application: thinkingdata.quick.min.js
Small games:
- WeChat games: thinkingdata.mg.wx.min.js
- QQ mini game: thinkingdata.mg.qq.min.js
- ByteDance mini-games: thinkingdata.mg.tt.min.js
- Baidu games: thinkingdata.mg.swan.min.js
- Bilibili mini-games: thinkingdata.mg.bl.min.js
- Huawei Quick Game: thinkingdata.mg.huawei.min.js
- OPPO quick game: thinkingdata.mg.oppo.min.js
- LI @ @ VE: thinkingdata.mg.vivo.min.js
- Meizu Quick Game: thinkingdata.mg.mz.min.js
- Xiaomi Quick Game: thinkingdata.mg.xiaomi.min.js
- H5 mini-games
- UC Games
- Facebook games
# I. Integrated SDK
Note that before reporting data, please add the data transmission URL to the request list of the server domain name in the development settings of WeChat public platform or other platforms.
# II. Configure SDK
As in the previous example, you need to call the init
method to initialize the SDK:
ta.init();
After the initialization method init
is actively called, the data will actually be reported. This allows you to control when data starts reporting, ensuring that you have completed the necessary settings for the SDK (user ID, public event properties, etc.) before data starts reporting.
# 2.1 Set Visitor ID
By default, the SDK will randomly generate a guest ID to identify the user. You can call the identify
interface to customize the guest ID:
// Set the visitor ID corresponding to #distinct_in the reported data ID
ta.identify("your_own_anonymous_id");
::: tip, please set the guest ID before the init
interface call is completed. If you need to use WeChat open ID as a guest ID, you can call identify
to set the guest ID in the callback of the open ID, and then call init
to complete
SDK initialization
:::
# 2.2 Set Account ID
When the user generates login behavior, you can call login
to set the user's account ID. TA platform priority to account ID as the identity ( user identification rules )
, the set account ID will be saved, and multiple calls to login
will overwrite the previous account ID:
// Set account ID corresponding to #account_in the reported data ID
ta.login("ABC_123456");
After the user produces login behavior, you can call logout
to clear the account ID. Before the next call to login
, the guest ID will be used as the identification ID:
// Remove #account_from reported data ID field
ta.logout();
WARNING
The login
and logout
methods are only used to set and clear the account ID, and will not report user login and logout events.
# 2.3 Set Public Event Properties
TIP
Public event properties are properties that all events (including auto-collect events) will include, and are not included in user features .
This section describes how to set public event properties and dynamic public properties. If the public property has the same key value as the custom property set in the event, the final property is valued according to the following priority:
User custom event properties > Dynamic public properties > Event public properties
# 3.3.1 Set event public properties
You can call setSuperProperties
to set the public event properties, which are formatted in the same way as the event properties. Only constants can be passed in during setting, which is suitable for setting attributes that do not change frequently.
According to the property priority, the custom property priority is higher than the event public property, so the event public property can also be used as the default value of a property, setting the key of the same name to override the default value in the event that needs to be modified.
//Set Common Event Properties
ta.setSuperProperties({ channel: "channel" });
//Upload events using track with common event attributes
ta.track(
"Purchase", //Name of tracking event
{
Item: "Product A",
ItemNum: 1,
Cost: 100,
} //Event attributes to upload
);
/* Equivalent to adding these common attributes to an event
ta.track(
'Purchase', //Name of tracking event
{
Item:'Product A',
ItemNum:1,
Cost:100,
channel:'channel' //Equivalent to adding this attribute to an event
}
);
*/
If you call setSuperProperties
multiple times to set the public event property, the call after the field with the same name overrides the previous field with different names.
If you need to delete a public event property, you can call unsetSuperProperty ()
to clear one of the public event properties; if you want to empty all public event properties, you can call clearSuperProperties ()
; if you want to get all public event properties, you can call getSuperProperties
;
// Clear public property named CHANNEL
ta.unsetSuperProperty("CHANNEL");
//Clear common event attributes
ta.clearSuperProperties();
//Get static common event attributes
ta.getSuperProperties();
# 3.3.2 Setting dynamic public properties
You can call the setDynamicSuperProperties
interface and pass in a callback function to set dynamic public properties. The return value of the callback function is added to the event property as a public property:
// Setting UTC time as event attribute reporting via dynamic common attributes
ta.setDynamicSuperProperties(() => {
var localDate = new Date();
return {
utcTime: new Date(
localDate.getTime() + localDate.getTimezoneOffset() * 60000
),
};
});
The callback function must return a JS object, where each element represents an attribute. The attribute format must be consistent with the event attribute.
# III. Send Events
You can directly call track
to upload custom events. It is recommended that you set the attributes of the event and the conditions for sending information according to the previously combed doc. Here, take the purchase of goods as an example:
ta.track(
"Purchase", //Name of tracking event
{
Item: "Product A",
ItemNum: 1,
Cost: 100,
Elements: ["apple", "ball", "cat"],
} //Event attributes to upload
);
The track
interface has two parameters, the first parameter is the name of the event, and the second parameter is the attribute of the event- The name of the event is string, can only start with a letter, can contain numbers, letters and the underscore "_", is up to 50 characters in length, and is not sensitive to letter case.
- The properties of the event are JS objects, and each element represents a property.
- The name of the element corresponds to the name of the attribute. It is stipulated that only letters can be used at the beginning, including numbers, letters and underscore "_". The maximum length is 50 characters and is not sensitive to case of letters.
- The value of the element is the value of the property, supporting
String
,Number
,Boolean
,Date
andArray
.Note: Array type attributes are supported in versions after v1.5.0, and need to be compatible with TA platform 2.5 and later versions.
The Mini Program SDK will get the scene value when the Mini Program starts (onlaunch
). If the scene value can be obtained, in the Life Time of this Mini Program, all events will have the attribute of #scene
.
# 3.1 Set Event Reporting Time
The time when the event is triggered defaults to the local time, but in some cases, you may need to manually set the time of the event. You can use the following methods to call:
//The third parameter, which can be entered as a Date type parameter, replaces the event triggering time
ta.track("event", { parakey: "paravalue" }, new Date());
//If no properties need to be uploaded, pass in an empty object
ta.track("event", {}, new Date());
- The third parameter is the event trigger time, which must be of type Date. The event trigger time will be replaced. If this parameter is not passed, the event trigger time will default to the user's native time
# 3.2 Record the Duration of the Event
You can call timeEvent
to start timing, configure the event type you want to time, and when you upload the event, you will automatically add #duration
to your event attribute to indicate the length of the record, in seconds.
//The user enters the merchandise page and starts timing with the event "Enter_Shop"
ta.timeEvent("Enter_Shop");
//...
//Upload the event, the timer ends, and the event "Enter_Shop" will have the attribute #duration"for the duration of the event
ta.track("Enter_Shop", { product_id: "A1354" });
# IV. User Attributes
# 4.1 Set User Features ( userSet )
For general user features, you can call userSet
to set it. Attributes uploaded using this interface will overwrite the original attribute values. If the user feature does not exist before, the user feature will be created
//Set user attributes, membership levels
ta.userSet({ vip_level: "Diamond Members" });
Consistent with the event attribute when uploading an event, the user feature passed in here is also an object type. Name corresponds to the name of the attribute. It is stipulated that only letters can be started, including numbers, letters and underscores '_'. The maximum length is 50 characters. It is not sensitive to case of letters. Value is the value of the attribute and supports String
、Number
、Boolean
、Date
和 Array
.
Note: Array types are supported in versions above v1.5.0 and need to be used in conjunction with TA platform 2.5 and later versions.
# 4.2 Initializing User Features ( userSetOnce )
If the user feature you want to upload only needs to be set once, you can call userSetOnce
to set it. When the attribute already has a value before, this information will be ignored.
//For example, set the username. If the username is set, ignore this setting and if it does not exist, set it to the incoming value
ta.userSetOnce({ user_name: "TA" });
The parameter requirements of userSetOnce are consistent with userSet.
# 4.3 Accumulate User Features ( userAdd )
When you want to upload a numeric attribute, you can call userAdd
to accumulate the attribute. If the attribute has not been set, a value of 0 will be assigned before calculation
//For example, if the user calls this interface every time he pays, then'total_ The revenue'field processes the accumulated payment amount each time
ta.userAdd({ total_revenue: 50 });
Consistent with the event attribute when uploading an event, the user feature passed in here is also an object type. Name corresponds to the name of the attribute. It can only start with letters, including numbers, letters and underscores '_'. The maximum length is 50 characters. It is not sensitive to the case of letters. Value is the value that the attribute needs to be accumulated. Only Number
Type, passing in negative numbers is equivalent to subtraction.
# 4.4 Reset User Features ( userUnset )
When you want to empty a user feature value of a user, you can call userUnset
to empty the specified attribute. If the attribute has not been created in the cluster, the userUnset
will not create the attribute
//Clear property is a user property value with the name userPropertykey. This user is set to NULL
ta.userUnset("userPropertykey");
# 4.5 Delete User ( userDel )
If you want to delete a user, you can call userDel
to delete the user. You will no longer be able to query the user features of the user, but the events generated by the user can still be queried
ta.userDel();
# 4.6 Append Elements to User Features of Type Array ( userAppend )
Since v1.5.0, you can call userAppend
to append elements to user data of type Array (List).
ta.userAppend({ Elements: [("a": 1), ("b": 2)] });
Note: This feature needs to be used with TA platform 2.5 and later versions
# V. Automatic Acquisition Events
After version 1.2.0, we provide automatic collection function. Just open the events you need to automatically collect in the config where you create the instance. The SDK will automatically collect some behaviors of the Mini Program. Now there are mainly the following events to support automatic collection:
Automated data collection now supported are:
- Mini Program initialization, users will only trigger once
- Mini Program startup, including startup and background transfer back to the foreground
- Mini Program is transferred to the background and records the time of this visit (start to transfer to the background)
- The Mini Program page displays or cuts into the foreground, automatically recording the path of the page and the forward path
- Mini Program for forwarding and sharing, automatically record the page when forwarding
Next, we will introduce in detail the collection method of each data
# 5.1 Turn on automatic collection events
In config, the element in the parameter autoTrack
represents the switch for each automatic acquisition event. Set to true
to turn on automatic acquisition:
var config = {
appid: "YOU-APP-ID",
server_url: "https://youserverurl.com",
autoTrack: {
appLaunch: true, // Automatic acquisition ta_mp_launch
appShow: true, // Automatic acquisition ta_mp_show
appHide: true, // Automatic acquisition ta_mp_hide
pageShow: true, // Automatic acquisition ta_mp_view
pageShare: true, // Automatic acquisition ta_mp_share
},
};
AppLaunch
: Auto Capture Mini Program InitializationAppShow
: Auto Capture Mini Program starts or enters the foreground from the backgroundappHide
: Auto Capture Mini Program from Front Desk to BackstagePageShow
: Automatically capture Mini Program page display or cut into the foregroundPageShare
: Automatic collection of Mini Program for forwarding and sharing
Different platforms support different automatic collection events due to operating environment and structural reasons. The support list is as follows:
Platform | appLaunch | appShow | appHide | pageShow | PageShare |
---|---|---|---|---|---|
Mini Program | √ | √ | √ | √ | √ |
Small game | √ | √ |
# 5.2 Detailed Automated Acquisition Events
# 5.2.1 Mini Program Initialization
Mini Program initialization will be triggered when the Mini Program is opened for the first time, or when the user kills the process and restarts it. It will only be triggered once in the Life Time of the process. The detailed events are described as follows:
- Event name: ta_mp_launch
- Automatic collection of attributes:
#scene
, scene value, taken from the scene value provided by WeChat
Through the Mini Program initialization event, you can calculate the number of users' usage per day and the number of users per capita, including grouping by scene values to see the usage of users with different scene values.
# 5.2.2 Mini Program Start
Mini Program startup will be triggered when the Mini Program is started or the Mini Program is transferred back to the foreground from the background. The detailed events are described as follows:
- Event name: ta_mp_show
- Automatic collection of attributes:
#Scene
, scene value, taken from the scene value provided by WeChat#url_path
, page path, the path of the page to be displayed when the Mini Program starts
Mini Program startup is not suitable for direct analysis because it will be affected by the number of calls (more), but it can identify a user's use in the behavior path, which can be used as the initial behavior of the user's behavior path
# 5.2.3 Mini Program Hide
Mini Program Hide will be triggered when Mini Program is transferred to the background, and record the duration of this use. The detailed events are described as follows:
- Event name: ta_mp_hide
- Automatic acquisition properties:
#Scene
, scene value, taken from the scene value provided by WeChat#duration
, numeric type, indicating the duration from this start (ta_mp_show) to hidden
Mini Program hidden events record usage time in seconds, so you can directly calculate the total usage time and timespan per person, or you can divide by the number of initializations to calculate the single usage time.
# 5.2.4 Mini Program Page View
Mini Program page browsing will be triggered when the Mini Program page is opened or when the Mini Program is transferred back to the front desk from the background to display the page. The path of the page and the forward path of the visit will be recorded. The detailed event description is as follows:
- Event name: ta_mp_view
- Automatic acquisition properties:
#Scene
, scene value, taken from the scene value provided by WeChat#url_path
, the page path, which is the path of the displayed page#referrer
, forward path, the path of the page before the page is displayed, that is, the path before jumping. If it is the home page displayed when starting the Mini Program, the value is "Open directly"
Through the Mini Program page browsing events, you can calculate the pv, uv of each page, and the user's access path to the Mini Program.
# 5.2.5 Mini Program Page Forwarding and Sharing
Mini Program page forwarding sharing will be triggered when the forwarding button is clicked (including the forwarding button in the upper right navigation bar and the forwarding button in the page). The detailed event description is as follows:
- Event name: ta_mp_share
- Automatic collection of attributes:
#Scene
, scene value, taken from the scene value provided by WeChat#url_path
, the page path, which is the page path when forwarding
Mini Program page forwarding sharing events are suitable for analyzing the sharing rate of pages and can help you optimize page forwarding.
# VI. Other Functions
# 6.1 Multiple Instances
Starting with v1.3.0, this SDK supports multiple instances. We refer to the instance ta initialized by the methods described above as the main instance, and the instance created by the methods described in this section as the sub-instance.
Device-related preset attributes (including device IDs) are shared between multiple instances, and other attributes are not shared, including:
#distinct_id
Visitor ID#account_id
Account ID- Public event properties, dynamic public properties
TimeEvent
monitored events
You can create child instances to report data to another project, or to another set of user IDs.
// Create a sub-instance TT with the same default configuration as the main instance
ta.initInstance("tt");
// Set Visitor ID for Sub-instance
ta.tt.identify("another_distinct_id");
// Upload events via subinstance
ta.tt.track("event_from_tt_instance");
// Create sub-instances of different configurations
var config = {
appid: "ANOTHER-APP-ID",
enablePersistence: true, // Open local caching for sub-instances
};
ta.init("tt_1", config);
ta.tt_1.track("event_from_tt_instance");
# 6.2 Get the Device ID
You can call getDeviceId ()
to get the device ID. Due to the operating environment, the device ID will be saved in the local cache. Once the user deletes the cache, the device ID will change, so the device ID cannot be guaranteed to be stable
var deviceId = ta.getDeviceId();
# 6.3 onCompelete Callback Function
Starting from v1.3.1, for track, userSet, userSetOnce, userAdd, userDel and other interfaces, onComplete callbacks are supported. You can directly pass onComplete after the original parameter list,
You can also use parameter objects. If you use parameter objects, the parameter objects must include onComplete, otherwise parameter errors will occur.
Take the above event as an example:
// Input callbacks as parameter lists
ta.track("test", { testkey: 123 }, new Date(), (res) => {
console.log(res);
});
// Input callback as a parameter object
ta.track({
eventName: "test", // Required
properties: { testkey: 123 }, // optional
time: new Date(), // optional
onComplete: (res) => {
console.log(res);
}, // Required
});
The parameter res of onComplete is of type object, with two properties code and msg.
res.code type int, defined as follows:
- 0: Success
- -1: Incorrect data format
- -2: APP ID is invalid
- -3: Network or server level exception
The Debug mode is defined as follows:
- 0: Success
- -1: Parameter or permission verification problem
- 1: Represents the basic error of the field, and will give detailed error fields and reasons
- 2: Indicates the whole error
- -3: Network or server level exception
res.msg is a written description of res.code.
# 6.4 Open Debug Mode
Starting from v1.6.0, the client side SDK supports Debug mode and needs to be used with TA platform versions after 2.5.
Debug mode may affect the quality of data collection and the stability of the app. It is only used for data verification during the integration phase and should not be used in online environments.
The current SDK instance supports three operating modes:
- "None": Do not open Debug
- "Debug": Open Debug mode and put it into storage
- "DebugOnly": Open Debug mode, no storage
SDK initialization:
var config = {
appid: "YOUR_APPID",
server_url: "YOUR_SERVER_URL",
debugMode: "debug",
};
var ta = new TA(config);
In order to prevent Debug mode from going live in the production environment, it is stipulated that only specified devices can turn on Debug mode. Debug mode can only be enabled on the client side, and the device ID is configured in the 'Debug Data' section of the 'Event tracking management' page in the background of the TA.
The device ID can be obtained in three ways:
- #device_id attribute in event data in TA platform
- Called through the instance interface: get device ID
# VII. Relevant Preset Attributes
# 7.1 Preset Properties for All Events
The following preset attributes are those that will be associated with all events in the widget/widget SDK, including auto-capture events
Attribute name | Chinese name | Description |
---|---|---|
#ip | IP address | The user's IP address, which the TA will use to obtain the user's geographic location information |
#country | Country | The country where the user is located, generated according to the IP address |
#country_code | Country code | The country code of the country where the user is located (ISO 3166-1 alpha-2, that is, two uppercase English letters), generated based on the IP address |
#province | Province | The user's province is generated according to the IP address |
#city | City | The user's city is generated according to the IP address |
#device_model | Equipment model | The model of the user equipment, such as iPhone 8, etc |
#device_id | Device ID | The user's device ID, which takes the UUID generated during initialization |
#screen_height | Screen height | The screen height of the user equipment, such as 1920, etc |
#screen_width | Screen width | The screen height of the user equipment, such as 1080, etc |
#manufacturer | Equipment manufacturer | Manufacturers of user equipment, such as Apple, vivo, etc |
#os_version | Operating system version | iOS 11.2.2、Android 8.0.0 等 |
#os | Operating system | Such as Android, iOS, etc |
#network_type | Network status | Network status when uploading events, such as WIFI, 3G, 4G, etc |
# lib | SDK type | The type of SDK you access, such as MP (Mini Program), MG (Mini Game), etc |
#lib_version | SDK version | The version you access to the SDK |
#scene | Scene value | The incoming scene value when the WeChat Mini Program starts |
#mp_platform | Mini Program Platform | Identify the platform where the application is located |
#zone_offset | Time zone offset | The number of hours the data time is offset from UTC time |
# 7.2 Preset Properties for Automatic Acquisition Events
The following preset properties are unique to each AutoCollect event
- Preset properties for Mini Program startup (ta_mp_show)
Attribute name | Chinese name | Description |
---|---|---|
#url_path | Page path | Mini Program Launch Path to Displayed Page |
- Mini Program Hide (ta_mp_hide) Preset Properties
Attribute name | Chinese name | Description |
---|---|---|
#duration | Event duration | Indicates the duration of this startup ta_mp_show to hide ta_mp_hide , in seconds |
- Preset properties for Mini Program page browsing (ta_mp_view)
Attribute name | Chinese name | Description |
---|---|---|
#url_path | Page path | Page path, that is, the path of the displayed page |
#referrer | Forward path | The path of the page before the displayed page, that is, the path before the jump, if it is the home page displayed when starting the Mini Program, the value is "Open directly." |
- Preset properties for Mini Program page forwarding sharing (ta_mp_share)
Attribute name | Chinese name | Description |
---|---|---|
#url_path | Page path | The path of the page where the Mini Program was forwarded |
# 7.3 Get Prefabricated Attributes
When server level event tracking requires some preset properties on the App side, you can obtain the preset properties on the client side through this method and then pass them to the server level.
//Get Attribute Object
var presetProperties = ta.getPresetProperties();
//Generate event preset properties
var properties = presetProperties.toEventPresetProperties();
/*
{
"#device_model":"iPhone 5",
"#device_id":"3204487163-1624513721217",
"#screen_width":320,
"#screen_height":568,
"#os":"iOS",
"#os_version":"10.0.1",
"#network_type":"wifi",
"#zone_offset":8,
"#manufacturer":"Apple"
}
*/
//Get a preset property
var os = presetProperties.os; //os type,as Android
var osVersion = presetProperties.osVersion; //System Version Number
var networkType = presetProperties.networkType; //Network Type
var manufacture = presetProperties.manufacture; //Device Manufacturer
var deviceModel = presetProperties.deviceModel; //Device Model
var screenWidth = presetProperties.screenWidth; //Screen width
var screenHeight = presetProperties.screenHeight; //Screen height
var deviceId = presetProperties.deviceId; //Device ID
var zoneOffset = presetProperties.zoneOffset; //Time zone offset value
IP, country city information is generated by server level parsing, and the client side does not provide an interface to obtain these attributes
# VIII. Advanced Functions
Starting from v1.7.0, the SDK supports the reporting of three special types of events: first-time events, updatable events, and rewritable events. These three events need to cooperate with TA system 2.8.
Since special events only apply in certain scenarios, please use special events to report data with the help of Count Tech's customer success and analysts.
# 8.1 First Incident
First-time events are events that are recorded only once for a device or another dimension ID. For example, in some scenarios, you may want to record the first event on a device, you can use first-time events to report data.
// Instance: Report device first event, assuming event name is DEVICE_ FIRST
ta.trackFirstEvent({
eventName: "DEVICE_FIRST",
properties: { INT_PROPERTY: 0 },
});
If you want to determine whether it is the first time in a dimension other than the device, you can set FIRST_CHECK_ID for the first event. For example, if you need to record the first event of an account, you can set the account ID to the FIRST_CHECK_ID of the first event:
// Instance: First event to report a user account, assuming the event name is USER_ FIRST
// FIRST_Setting User ID to First Event CHECK_ ID
ta.trackFirstEvent({
eventName: "USER_FIRST",
firstCheckId: "YOUR_ACCOUNT_ID",
properties: { INT_PROPERTY: 0 },
});
Note: Due to the completion of the verification of whether it is the first time at the server level, the first event will be delayed by 1 hour by default.
# 8.2 Updatable Events
You can implement the need to modify event data in a specific scenario through updatable events. Updatable events need to specify an ID that identifies the event and pass it in when the updatable event object is created. The TA background will determine the data that needs to be updated based on the event name and event ID.
// Instance: Report an event that can be updated, assuming the event name is UPDATABLE_ EVENT
ta.trackUpdate({
eventName: "UPDATABLE_EVENT",
properties: { status: 3, price: 100 },
eventId: "test_event_id",
});
// Event attributes after reporting are status 3 and price 100
ta.trackUpdate({
eventName: "UPDATABLE_EVENT",
properties: { status: 5 },
eventId: "test_event_id",
});
// Event attributes status is updated to 5 after reporting, price remains unchanged
# 8.3 Rewritable Events
Rewritable events are similar to updatable events, except that rewritable events will completely cover historical data with the latest data, which is equivalent to deleting the previous data and storing the latest data in effect. The TA background will determine the data that needs to be updated based on the event name and event ID.
// Instance: Report an event that can be overridden, assuming the event name is OVERWRITE_ EVENT
ta.trackOverwrite({
eventName: "OVERWRITE_EVENT",
properties: { status: 3, price: 100 },
eventId: "test_event_id",
});
// Event attributes after reporting are status 3 and price 100
ta.trackOverwrite({
eventName: "OVERWRITE_EVENT",
properties: { status: 5 },
eventId: "test_event_id",
});
// Event attributes status is updated to 5 and price attributes are deleted after reporting
# Release Notes
v2.0.2 2021/12/31
- Code optimization
v2.0.1 2021/11/15
- Code optimization
v2.0.0 2021/09/15
- Support pause/start, stop/resume data reporting
- Support event blacklist
- Code optimization
v1.8.2 2021/06/24
- Support prefabricated attribute acquisition
v1.8.1 2021/03/08
- Added Kuaishou Mini Program support
v1.8.0 2020/11/20
- Added support for Bilibili games, Xiaomi games and H5 games
- Improved game engine support: support ts project access
- Perfect game engine support: support common small games, fast game platforms (Huawei, Xiaomi, OPPO, VIVO), H5 games
- Optimization of other code details
v1.7.1 2020/08/27
- Support Meizu platform
v1.7.0 2020/08/24
- Supports first events, updatable events, rewritable events
v1.6.2 2020/07/23
- Support DingTalk Mini Program
- Fix Huawei fast game reporting anomaly
v1.6.1 2020/07/10
- Support Huawei fast games
v1.6.0 2020/06/10
- Support debug mode
v1.5.0 2020/02/10
- Attribute values support Array types
- Add userAppend interface
- Remove local property value checking
v1.4.4 2019/12/24
- Fix VIVO and OPPO platforms for the first time appHide without timing
v1.4.3 2019/12/20
- Optimize OPPO fast game network requests
v1.4.2 2019/11/20
- Support OPPO, VIVO fast games
v1.4.0 2019/10/22
- Added
userUnset
interface to clear a user feature - Added preset property
#zone_offset
in hours. By default, the offset of the local time zone is reported to the server level, which is affected by daylight saving time. The following formula is satisfied:
utc_time + #zone_offset = #event_time
v1.3.2 2019/09/29
- Fix compatibility issues of some platforms introduced in v1.3.1
v1.3.1 2019/09/27
- Track, userSet, userSetOnce, userAdd, userDel interface add callback function
v1.3.0 2019/08/15
- Code optimization
#network_type
Properties are updated according to network status- Data transmission content: user feature data does not transmit preset attributes, simplifying the transmission content
- Optimize log printing
- New interface
getAccountId()
getDistinctId()
timeEvent()
initInstance()
identify()
asauthorizeOpenID()
getDeviceId()
getSuperProperties()
unsetSuperProperty()
setDynamicSuperProperties()
- Multiple instances
- You can create a new instance by calling
initInstance (name, config)
. - The child instance uses the configuration of the parent instance by default, and local caching is not enabled by default
- You can create a new instance by calling
- Configuration information
EnablePersistence
The parent instance defaults to true and the child instance defaults to falseAsyncPersistence
Asynchronous Read CacheMaxRetries
The number of retries when the request fails or timeouts, the default is 3SendTimeout
timeout in millisecondsWhether enableLog
turns on log printing
- Cross-platform
- Support mainstream Mini Program small game platform: WeChat, Baidu, Alipay, ByteDance, fast application
- Add preset attribute
#mp_platform
to identify the platform where the application is located #Lib
is MP/MG, representing Mini Program and Mini Games respectively