Common Attributes
Understand the key attribute used across Unbxd Analytics API for event tracking and session mapping.
The following attributes are utilized as parameters across various endpoints and resources within the API.
uid (userId)
A unique identifier (uid
) is generated for each shopper, remaining consistent unless manually cleared. This uid
is a random number tied to the shopper’s specific browser and device. If a shopper uses different browsers or devices, separate uid
s are created.
For consistent cross-device experiences, use your logged-in shopper’s customer ID instead of a random value.
Name | Type |
---|---|
uid | String |
How to Generate uid
uid
To effectively manage sessions across multiple platforms with a shared catalog and user base, map each user to a unique uid
. This supports seamless tracking.
-
Default Behavior:
var uid = 'uid-' + date.getTime() + '-' + Math.floor(Math.random() * 100000);
-
For Logged-in Users:
var uid = md5(customerId);
Constraints
- Use the code patterns above to generate
uid
. - Store it (e.g., in cookies or localStorage) and pass it in API requests.
- Avoid using personally identifiable information (e.g., unencrypted user IDs or device IDs).
- Ensure compliance with GDPR and other data privacy standards.
visitId
A session or visit identifier that expires after 30 minutes of inactivity.
Name | Type |
---|---|
visitId | String |
How to Generate visitId
visitId
-
Web Browsers:
Automatically created by the Netcore Unbxd Analytics script via cookies. -
Mobile Apps:
visitId = 'visitId-' + now + '-' + Math.floor(Math.random() * 100000);
Constraints
- Must expire after 30 minutes of inactivity.
- When reset, a new "Visit" event must be triggered.
url
Refers to the page URL where the shopper initiated a search.
Name | Type |
---|---|
url | URL string |
Example
If a shopper searches from the page:
https://www.example.com/electronics/laptops
Then url
should capture this page — the origin of the search trigger — even before redirecting to the search results page.
referrer
Captures the URL of the page that led the user to the current one.
Name | Type |
---|---|
referrer | URL string |
referrer = sessionStorage.getItem('urlPrevious') || document.referrer || '';
Example
If a shopper navigates from:
https://www.example.com/gaming-laptops
to:
https://www.example.com/electronics/laptop-1
Then the referrer would be:
https://www.example.com/gaming-laptops
Useful for understanding navigation paths and traffic sources.
UnbxdKey
A unique site identifier key (also known as SiteKey) assigned to each environment (Dev, Stage, Prod).
Name | Type |
---|---|
UnbxdKey | String |
How to Find Your SiteKey
- Log in to the Unbxd Console ↗
- Choose your site from the top dropdown.
- Navigate to: Manage > Configure Site > Keys
- Copy the key from the Keys page using the "Copy" button.
action
Indicates the type of user interaction being tracked (e.g., click, visit, search).
Event | Action Value | Data Type |
---|---|---|
Search Hit | search | String |
Add to Cart | cart | String |
Visitor | visitor | String |
Product Click | click | String |
Orders | order | String |
timestamp
Denotes the exact time when an event is triggered, combining the time in milliseconds with a random decimal for uniqueness.
Name | Type |
---|---|
timestamp (t) | String |
t = new Date().getTime() + '|' + Math.random();
Breakdown
new Date().getTime()
— Current time in milliseconds since epoch.'|'
— Separator.Math.random()
— Adds uniqueness in case of duplicate millisecond timestamps.
Example
t = 1662365253141 | 0.6835012308821242
Ensures each event is uniquely identifiable even when triggered simultaneously.
Updated 16 days ago