1. User association

The purpose of user association is to uniquely identify users and improve the accuracy of user behavior analysis. At present, we provide simple user association and global user association to support different business scenarios.

2. User attribute

  • For the difference between event properties and user properties, seedata model
  • For naming restrictions on user attributes, seedata format

For simple user association and global user association scenarios, the Settings of user properties correspond to different interfaces. For details, see the following links based on service requirements.

3. Tracking event acquisition

After SDK initialization is complete, you can bury data through the following interface.

3.1. Trace event

For simple user association and global user association scenarios, tracking events correspond to different interfaces. Refer to the following links based on service requirements.

3.2. Item metadata report

In the Sensors recommendation project, customers need to report the item metadata to carry out the subsequent development and maintenance of the recommendation business. The Analytics SDK provides methods for setting and deleting item metadata.

item_id (item ID) and item_type (item type) together form the unique identification of an item. All item family methods must specify both the item ID and the type of the item in order to operate on the item.

3.2.1. Set item

Set an item directly and overwrite it if it already exists. In addition to the item ID and type of the item, other item properties need to be defined in $properties.

In item attributes, the constraints on the attribute name and attribute value are the same as those on event attributes. For details, please refer todata format.

// 示例 itemType := "apple" itemId := "12345" err = sa.ItemSet(itemType, itemId, map[string]interface{}{"price": "3",})
CODE

3.2.2. Delete an item

If the item cannot be recommended and needs to go offline, just delete it, or ignore it if it does not exist.

Other than the item ID and type of the item, no other item attributes are parsed.

// 示例 itemType := "apple" itemId := "12345" err = sa.ItemDelete(itemType, itemId)
CODE

4. Event attribute

As in the previous example, you can set custom event attributes for tracking events. For example, in browsing product events, information such as product ID and product classification can be used as event attributes. In the subsequent analysis work, the event attribute can be used as a statistical filter condition or as a dimension for multidimensional analysis. For event attributes, there are some constraints on divine analysis:

  • The event attribute is one JSON object
  • JSON element in the command describes an attribute. Key is the attribute name and must be String type
  • JSON 中,每个元素的 Value 是属性的值,支持 StringNumberArray<String>Date

For more constraints on event attributes in strategy analysis, see data format

4.1. System preset attribute

For example, the attributes starting with "$" in the event attribute are system preset attributes. You can override these preset attributes by filling in the corresponding attribute value starting with "$" in the user-defined event attribute:

  • $ip - If you enter this attribute, the analysis will automatically resolve the user's province and city information based on the IP address. The value of this attribute is string type;
  • $time - Fill in the property, and Divine Analysis sets the event time to the property value, which is of type int64. Please note that by default, the data before 365 days or after 3 days will be filtered out. Please contact us if you need to change it.

For more preset properties, see data format In the "Preset Properties" section.

4.2. Event common attribute

In particular, if an attribute of an event occurs in all events, you can use RegisterSuperProperties() set this property to the event public property. For example, set the application version of the server and the equipment room address as the public attributes of the event.


sa.RegisterSuperProperties({ appVersion: '1.0.0', env: 'production' });
CODE

Using the ClearSuperProperties() function will remove all previously set event super properties. Using the UnregisterSuperProperty() function will remove the specified key from the event super properties.

When there is a conflict between the event super properties and the event properties, the event properties have the highest priority and will overwrite the event super properties.