Tracking Page Views

An important property you send which each event is the pageId.

This is a unique identifier for each page which is used to collate events sent from that page view together.

For example you may view a page, then a list of products on that page (Product List Viewed) and then add one of these products to a cart (Product Added).

We suggest using a unique string such as a UUID, nanoID or ulid.

Page Views

For each page view on your website, or view of a screen on your mobile app, you can send along an event with type "page".

Example

{
  "messageId": "b3ea1a6c-5156-4030-8c67-nnb496ab473e",
  "writeKey": "6Zbh5IabhQViWaflO4Lbc",
  "timestamp": "2023-11-15T18:22:46Z",
  "type": "page",
  "userId": "5.essgdp8XSgs0GmsIdxh.1668536180",
  "sessionId": "09ec94a6cd542d5cc9e98e090fc22112",
  "pageId": "09ec92a6cd542d5cc9e98e090fc22134-9",
  "context": {
    "page": {
      "url": "https://www.mystore.com/shoes/ID=BX5634",
      "referrer": "https://www.mystore.com/search.php?query=Men's+Shoes",
      "type": "product"
    },
    "ipAddress": "77.122.92.7",
    "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1"
  }
}

Last updated