Common Fields
Overview
Events produced with Analytics.js possess a standardized structure with fields that are common across all events. These fields provide many functions that aid in effectively utilizing an event for most use cases. Common fields typically describe user identity, their tracking consent opt-in or opt-out status, third-party identifiers associated with the device, timestamping, and other useful data.
Available Common Fields
The available Common Fields are shown below in JSON format:
{
"timestamp": "2024-01-10T23:08:40.090Z",
"integrations": {},
"anonymousId": "f8cc0f85-cb4d-4f73-b16f-c251384fdf74",
"type": "page",
"context": {
"page": {
"path": "/shop",
"referrer": "https://demo.metarouter.io/shop?ajs=https%3A%2F%2Fcdn.metarouter.io%2Fdemo-app%2Fmr-demo-team_product_sandbox_matt.js&writekey=mr-demo-team_product_sandbox_matt",
"search": "",
"title": "metashop",
"url": "https://demo.metarouter.io/shop?"
},
"providers": {},
"globalPrivacyControl": false,
"consent": {
"optOut": {
"C0001": false,
"C0002": false,
"C0003": false,
"C0004": false,
"C0005": false
}
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"locale": "en-US",
"library": {
"name": "analytics.js",
"version": "npm:next-1.51.3-mr.3"
}
},
"messageId": "05b0eb33e6948947f15973724147e34d",
"writeKey": "mr-demo-team_product_sandbox_matt",
"sentAt": "2024-01-10T23:08:40.095Z",
"_metadata": {
"bundled": [],
"unbundled": [],
"bundledIds": []
}
}
These fields are generally available with every event:
Field | Data Type | Description |
---|---|---|
anonymousId | String | A semi-persistent, unique identifier for a device. |
userId | String | A unique identifier for a user within your database. |
type | String | The event method that the event has been set to. |
context | Object | An object containing useful context about the event that was produced. See the Context section below for more information. |
messageId | String | A unique string for each event (message) that is produced. This can be used in conjunction with the Event Debugger to analyze the contents of a specific event. |
writeKey | String | The unique identifier for the Pipeline that will handle the event. |
sentAt | Date | Timestamp of when an event is sent to MetaRouter. sentAt is an ISO-8601 date string. |
receivedAt | Date | The time an event is ingested by MetaRouter. This value is automatically set once the event is ingested. |
timestamp | Date | Time that an event actually occurred. If the timestamp occurs in the future, we’ll set the timestamp value to the receivedAt value. |
The following sections provide information on fields that contain additional common fields nested within them.
Context
Field | Data Type | Description |
---|---|---|
page | Object | Contains information about page being viewed in the browser. Includes path, referrer, search, title, and url. |
path | String | The path of the URL that the current page contains. |
referrer | String | Contains information about where the user came from prior to visiting the website or app. Contains type , name , url and link fields. |
search | String | Provides the query that a user searched for to arrive at a page, if applicable. |
title | String | The title of the current page, as designated in the HTML of the page. |
url | String | The URL address of the current page. |
providers | Object | Depending on your configuration, the providers object may contain identifiers gathered by the Sync Injector. These should be mapped in the appropriate integrations to power downstream functionality that is reliant upon third-party identifiers. |
globalPrivacyControl | Boolean | Brings a Global Privacy Control flag into the event stream, allowing tracking to be allowed or denied by a user’s GPC settings. Please contact your Customer Success Manager if you’d like to use globalPrivacyControl consent flags. |
consent | Object | An object containing various categories of tracking that a user may opt out of tracking for. Requires the Compliance Module. |
userAgent | String | A collection of various device and browser attributes that form a User Agent string. |
locale | String | The language and location of the browser. |
library | Object | Provides information about the version of the Analytics.js library being used. Contains name and version fields. |
Integrations
The integrations
object has been deprecated. The context.providers
object contains information previously tracking within the integrations
object. In legacy configurations, the integrations
object may contain identifiers gathered by the Sync Injector.
_metadata
This _metadata
object is deprecated and will be removed from AJS files at a later date.
Updated 7 months ago