# User and Event Attributes Design
After project understanding is complete, the events that need to be tracked are basically identified, and the next step is to set attributes for these events and users. It is worth noting that the setting of event attributes and user attributes directly affects the depth of analysis, so how to set these attributes needs careful consideration. This section will briefly describe the main points of setting user and event attributes.
# Event Attribute or User Attribute?
Generally, an event is reported when a user produces meaningful behavior, so event attributes can not only reflect the attributes related to the event, but also reflect the state of the user when the behavior is performed. User attributes represent only the latest status of the user. For example, in a field that also represents a member level, the level in the event attributes represents the member level at which the user behaved, while the level of the user attributes is the user's current member level.
In addition, TA's client SDK will automatically collect some event properties and user features. If you want to know these properties, you can consult the preset properties.
# Which Attributes Should be Considered as Public Events Attributes?
The attributes of public events are attributes that affect every event. We recommend that you set important attributes or common attributes as attributes of public events before uploading events. We recommend that membership levels and channels be set as attributes of public events.
# Which Attributes Should be Regarded as Event Attributes?
Event attributes are unique to each event and need to be manually configured before you upload an event. To set event attributes, use the list of events you organized during the project understanding phase to set them based on your analysis needs and the conditions under which the data point triggers. If you are a technician, you want to know how to configure event attributes. You can consult the Data Access Guide for more information.
For the names of event attributes, we recommend that they be identified only in English capitals, lowercase and underscores, and that the names should be meaningful, rather than in Chinese. If there are attributes with the same meaning in different events, such as the purchase item ID in the submission order and the item ID when adding a cart, it is best to set the same attribute name, which acts as a merge attribute.
Attribute value types supported by TA are string type, numeric type and Boolean type as well as time. Chinese, English capitals, English lowercase, numbers and Boolean values can be used. For ease of use, for attribute values requiring specific meanings, please use Chinese assignment directly, such as Chinese for product names.
When you have set a property, add the name, type, and comments of the property to the collated event document, where the name, description, importance, analysis point, and property name, property type, and property meaning are given for each event.
# Which Attributes Should be Used as User Attributes?
User feature represents the user's constant attributes and the latest status. We recommend setting the following three attributes as user features:
(1) Fixed attributes: Fixed attributes refer to attributes that users will not change. These attributes are often information at the time of registration or information at the time of first generation of certain behaviors, such as registration time, registration source channel, gender, user name, first payment time, etc. For such an attribute, call user_setOnce
when event tracking, and suggest adding "first" before the attribute name.
(2) Latest Status: The latest status refers to the current status of the user, which is often the information of the user's last behavior, such as the last launch time, the last payment time, etc. For such properties, use the user_set
for event tracking and suggest that the property name be preceded by "latest."
(3) Accumulated value: Accumulated value is essentially a special form of the latest state. The data type of accumulated value is numerical type, which mainly refers to the number of important behaviors or the latest state of numerical types, such as accumulated payment times, accumulated payment amount, accumulated login times, etc. Please call user_add
during event tracking, and each call will accumulate on the original value.
After setting up the user features, add these properties to the organized event doc.