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:

FieldData TypeDescription
anonymousIdStringA semi-persistent, unique identifier for a device.
userIdStringA unique identifier for a user within your database.
typeStringThe event method that the event has been set to.
contextObjectAn object containing useful context about the event that was produced. See the Context section below for more information.
messageIdStringA 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.
writeKeyStringThe unique identifier for the Pipeline that will handle the event.
sentAtDateTimestamp of when an event is sent to MetaRouter. sentAt is an ISO-8601 date string.
receivedAtDateThe time an event is ingested by MetaRouter. This value is automatically set once the event is ingested.
timestampDateTime 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

FieldData TypeDescription
pageObjectContains information about page being viewed in the browser. Includes path, referrer, search, title, and url.
pathStringThe path of the URL that the current page contains.
referrerStringContains information about where the user came from prior to visiting the website or app. Contains type, name, url and link fields.
searchStringProvides the query that a user searched for to arrive at a page, if applicable.
titleStringThe title of the current page, as designated in the HTML of the page.
urlStringThe URL address of the current page.
providersObjectDepending 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.
globalPrivacyControlBooleanBrings 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.
consentObjectAn object containing various categories of tracking that a user may opt out of tracking for. Requires the Compliance Module.
userAgentStringA collection of various device and browser attributes that form a User Agent string.
localeStringThe language and location of the browser.
libraryObjectProvides 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.