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 (Type of item)Together they form the unique identity of an item. All item family methods must be specified simultaneouslyitem IDandType of itemtwo parameters, to complete the operation of the item.

3.2.1. Set item

Directly set an item, and overwrite if it already exists. Except for item ID and item category, other item properties need to be defined in $properties.

In item properties, the constraint conditions for attribute names and values are the same as event properties. For detailed information, please refer to the data format.

# 例如 item_type = 'apple' item_id = '12345' sa.item_set(item_type, item_id, {"price": "3"})
CODE

3.2.2. Delete an item.

If an item is not recommended and needs to be offline, you can delete the item. If it does not exist, ignore it.

Do not parse other item properties except for item ID and item category.

# 例如 item_type = 'apple' item_id = '12345' sa.item_delete(item_type, item_id)
CODE

4. Event properties

As in the previous example, custom event properties can be set for tracked events, such as product ID and product category in the browse product event. In subsequent analysis work, event properties can be used as statistical filtering conditions and dimensions for multidimensional analysis. There are some constraints for event properties in Sensors Analytics:

  • Event properties are a dict object
  • Each element in the dict describes an attribute. The key is the attribute name, which must be of type str
  • The value of each element in the dict is the value of the attribute, supporting str, int, float, list, datetime.datetime, and datetime.date

For more constraints on event properties in Sensors Analytics, please refer to the data format.

4.1. System pre-set properties

In the previous example, properties in event properties starting with '$' are system pre-set properties. Filling in the corresponding '$' starting property value in the custom event properties can override these pre-set properties:

  • $ip - By filling in this property, Sensors Analytics will automatically parse the province and city information of the user based on the IP address, and the value of this property must be of type str;
  • $time - By filling in this property, Sensors Analytics will set the event time to the time of the property value, and the value of this property must be of type datetime.datetime or datetime.date. Please note that Sensors Analytics defaults to filtering and ignoring data 365 days before or 3 days after. If you need to modify this, please contact us.

For more pre-set properties in Sensors Analytics, please refer to the "Pre-set properties" section in the data format.

4.2. Event common properties

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

//设置公共属性,以后上传的每一个事件都附带该属性 super_properties = { 'ServerVersion':'1.2', 'Location':'Beijing' } sa.register_super_properties(super_properties)
CODE

Use clear_super_properties() will delete all the public properties of the event that have been set.

When the Key of the event common attributes and event attributes conflict, the priority of the event attributes is highest, and it will override the event common attributes.