1. User Association

User association is used to uniquely identify users and improve the accuracy of user behavior analysis. Currently, Sensory provides a simple user association business scenario.

2. User Attributes

  • For the difference between event properties and user properties, please refer to the data model.
  • For naming constraints of user properties, please refer to the data format.

For simple user association scenarios, the setting of user properties corresponds to different interfaces. Please refer to the following links according to your business needs.

3. Event Tracking

After the SDK initialization is completed, you can perform data tracking through the following interface.

3.1. Track Event

For simple user association scenarios, tracking events correspond to different interfaces. Please refer to the following links according to your business needs.

3.2. Item Metadata Reporting

In the Sensory recommendation project, customers need to report item metadata to develop and maintain subsequent recommendation business. The Sensory Analytics SDK provides methods for setting and deleting item metadata.

item_id (Item ID) and item_type (Item Type) together make up a unique identifier for an item. All item-related methods must specify both the item ID and the item type in order to perform operations on the item.

3.2.1. Set Item

Directly set an item, which will override it if it already exists. In addition to the item ID and item type, 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" properties = { "price" => "3" } sa.item_set(itemType,itemId,properties)

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" sa.item_delete(itemType,itemId)

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 Sensors analytics:

  • The event attribute is  Hash object
  • InHash , each element describes an attribute, Key is the attribute name, must be String 或 Symbol type
  • Hash 中,每个元素的 Value 是属性的值,支持 StringSymbolIntegerFloatArrayTrueClass/FalseClass 和 Time

For more constraints on event attributes in strategy analysis, seedata 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 register_super_properties() 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.

# 示例 itemType = 'apple' itemId = '12345' properties = { 'ServerVersion' => '1.2', 'Location' => 'BeiJing' } sa.register_super_properties(properties) 

Use clear_super_properties will deletes all the public properties of the event that have been set.

When the event public attribute conflicts with the Key of the event attribute, the event attribute has the highest priority and overrides the event public attribute.