Managing Common Properties and User IDs
Setting Common Properties
You can set a list of common properties at boot loader.
<script src="//events.medio.com/jssdk" data-medio-key="medio_api_key" data-medio-cprop-key-id1="KeyName1" data-medio-cprop-value-id1="KeyValue1" ... data-medio-cprop-key-idN="KeyNameN" data-medio-cprop-value-idN="KeyValueN"> </script>
Replace idX with the js identifier for the X key/value pair, KeyNameX with the specific Xth common property name, and KeyValueX with the specific Xth common property value.
For example, product_version is a field that customers may want to attach to all events logged for a particular version of a website:
<script src="//events.medio.com/jssdk" data-medio-key="1a2b3c4d..." data-medio-cprop-key-prod_ver="product_version" data-medio-cprop-value-prod_ver="1.0.1"> </script>
There is no limit number for custom attributes at boot loader. The data attribute names (the js identifiers) must be at least one character long, must be prefixed with data-media-cprop-key- or data-media-cprop-value-, and should NOT contain any uppercase letters. The data attribute values can be any string, which can include of course, uppercase letters.
These properties are optional, and as shown below, they can be modified later.
Session ID and User ID
It may be desirable to set a session ID if an application does its own session tracking. Note that session count reporting simply counts the number of unique session IDs seen over a time period.
In addition, if your application has a strong, unique ID for each user or customer, the
user_id can be also set as a common property:
<script src="//events.medio.com/jssdk" data-medio-key="1a2b3c4d..." data-medio-cprop-key-s_id="session_id" data-medio-cprop-value-s_id="10901808223" data-medio-cprop-key-u_id="user_id" data-medio-cprop-value-u_id="A41D326420DAFFE"> </script>
user_id is treated as the strongest available identifier for a user. Our identity management system treats every single user_id as a distinct user. We recommend that you hash your user IDs before setting them if they contain any personally identifiable information.
Customers can also use a 10-digit MSISDN as a strong identifier (stronger than the SDK’s cookie-based anonymous id, but weaker than
user_id) that will also be used to determine user identity:
<script src="//events.medio.com/jssdk" data-medio-key="1a2b3c4d..." data-medio-cprop-key-msisdn="MSISDN" data-medio-cprop-value-msisdn="8005551212"> </script>
Removing or Changing Common Properties
Removing a Property
To remove a common property that was set at boot loader, use the unset method:
Changing a Property
To change the value of a common property that was previously set at boot loader, use the set method: