1. User login
This parameter is required when the user is successfully registered or logged in login() method incoming login ID:
sensors.login("登录 ID");
JS
For users who log in automatically, you can obtain the login ID and call it before SDK initialization login() method.
2. Custom anonymity ID
By default, the SDK generates an anonymous ID and can guarantee the uniqueness of the ID. If you need to replace the anonymous ID assigned by the default, you can call it immediately after initializing the SDK identify(“User-defined anonymous ID ”) method to replace.
sensors.identify("登录 ID");
JS
3. Switch back to anonymous ID
SDK provideslogout interface switches back to the call login before the interface Anonymous ID.
4. Clear local cache events
Can use deleteAll() method, delete all events stored locally by the App.
Do not call this method unless specifically requested
The deleteAll API supports only native.
If the pursuit of timeliness of data collection, you can call flush method, Force data to be sent to sensors analytics, for example:
The flush API supports only native.
6. Record activation event
Can call trackAppInstall method records activation events, and calling this method multiple times will only trigger the activation event on the first call:
var properties = {}; sensors.trackAppInstall(properties);
JS
The trackAppInstall API is native only.
7. Code bury trace event
Can use track() method tracks user behavior events and adds custom properties to events:
sensors.track( 'click', //事件名称 { name: '点击' //事件属性 } );
JS
8. Set User Properties
sensors.setProfile({ email:'xxx@xx', favoriteFruits: ['苹果', '油桃'], subscribers: 7277 });
CODE
9. Retain Initial Properties
For properties that need to be valid only when initially set, such as the user's first recharge amount or the nickname initially set, you can use the setOnceProfile interface for recording. Different from the setProfile method, if the user property being set already exists, this record will be ignored and will not overwrite the existing data. If the property does not exist, it will be automatically created.
// 设置用户属性 subscribers 为 7277 sensors.setOnceProfile({ email:'xxx@xx', favoriteFruits: ['苹果', '油桃'], subscribers: 7277 }); // 再次设置用户属性 subscribers 为 7278 不生效,属性值仍然是 7277 sensors.setOnceProfile({ subscribers: 7278
JS