Tracking Events

Events can be used to track anything; an interaction with a website, data coming from a weather station, or product returns to your warehouse.

Examples

Custom Event

  • event - the name of the event.

  • properties - key / value pairs. For custom properties only string and number is supported as the value.

{
  "type": "track",
  "timestamp": "2022-12-19T18:24:16.238Z",
  "userId": "1be7675b-202b-4ff8-95c0-656da2c08d2d",
  "sessionId": "28eef5c8-1098-4f76-abe9-58a921cabfaf",
  "messageId": "a57016c7-9c33-4aa0-9534-c96384bbb51e",
  "pageId": "eca34e0f-4802-4fa4-8db1-11c727839dbd",
  "writeKey": "<WRITE_KEY>",
  "context": {
    "page": {
      "url": "https://www.weather-station.com/",
      "path": "/",
      "referrer": "",
      "title": "Weather Station - Get Weather"
    },
  },
  "event": "WeatherTracked",
  "properties": {
    "weather": "Rain",
    "temperature": 37
  }
}

Semantic Event + Object

You can get extra functionality from Fanplayr 360 by using Semantic Events, and Semantic Objects. In this example we are using the "Product Viewed" event, along with the $product Semantic Object.

  • event - the name of the event.

  • properties - key / value pairs. Here you see a more complex example using $product which allows more than simply a string or number as value.

You can add custom properties along with your Semantic Events and Objects. Here we are tracking weather along with our $product.

{
  "type": "track",
  "timestamp": "2022-12-19T18:29:18.906Z",
  "userId": "1be7675b-202b-4ff8-95c0-656da2c08d2d",
  "sessionId": "28eef5c8-1098-4f76-abe9-58a921cabfaf",
  "messageId": "42167d8e-5fa6-4188-9ec4-5179dab84d84",
  "pageId": "180cf0b4-da99-4f5e-9698-29af50c683cf",
  "writeKey": "<WRITE_KEY>",
  "context": {
    "page": {
      "url": "https://www.weather-station.com/store/vase_1/",
      "path": "/",
      "referrer": "",
      "title": "Weather Station - Store"
    },
    "libraryVersion": "1.7.1"
  },
  "event": "ProductViewed",
  "properties": {
    "$product": {
      "id": "XB35A",
      "name": "Beautiful Vase",
      "price": 12.99,
      "currency": "EUR"
    },
    "weather": "Rain"
  }
}

Last updated