Managing Common Properties and User IDs

Setting Common Properties

For convenience the JavaScript SDK provides common properties that are applied to all events after being set once.

You can set a list of common properties at boot loader.

<script src="//" 
        data-medio-cprop-key-id1="KeyName1" data-medio-cprop-value-id1="KeyValue1" ...
        data-medio-cprop-key-idN="KeyNameN" data-medio-cprop-value-idN="KeyValueN">

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.

idX and KeyNameX strings can be different. idX will be used by JavaScript as an identifier, while KeyNameX will be used by the SDK as the common property key name.

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="//" 

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

User IDs and session ID are common properties that can be set in order to improve reporting accuracy. Although the JavaScript SDK creates its own anonymous user ID and session ID, stronger or more accurate IDs may be available from the application.

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="//" 

The 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="//" 

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:

Medio.Events.commonProperties.set("user_id", "B75E857390BDAAC");