Track

Explaining the track events, properties and the methods to propagate to destinations

The trackAPI call records the actions customers perform, along with the properties of the action.

Each action is called an event. Each event has a name and some properties associated with it along with an optional callback function. For example, the event name could be productViewed, while the properties can be sort, currency etc.

Example:

Sample JavaScript track event call:

lmSMTObj.track("productViewed", {
    "currency": "INR",
    "filters": "Price < 5000",
    "sort": "Price (Low to High)",
    "product": {
        "name": "Earbuds",
        "category": "Mobile Phone & Accessories",
        "position": 1
    }
}, {
    "trackerId": "6791c47a-0178-47bc-8711-86a2c67b2255"
}, function() {})

Sample track event payload:

{
  "id": "viz_6139c51ee9662",
  "userId": "6791c47a-0178-47bc-8711-86a2c67b2255",
  "otherIds": {
    "_fbp": 1631176031249,
    "_fbc": "6791c47a-0178-47bc-8711-86a2c67b2255",
    "_ga": "1631176031249",
    "trackerId" : "6791c47a-0178-47bc-8711-86a2c67b2255"
  },
  "context": {
    "library": {
      "name": "javascript",
      "version": "0.01"
    },
    "page": {
      "path": "/academy/",
      "referrer": "",
      "search": "",
      "title": "Analytics Academy",
      "url": "https://lemnisk.co"
    },
    "userAgent": {
      "deviceType": "DESKTOP",
      "osType": "Linux",
      "osVersion": "Linux",
      "browser": "Chrome",
      "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"
    },
    "ip": "108.0.78.21",
    "utm": {
      "campaign": "TPS Innovation Newsletter",
      "source": "Newsletter",
      "medium": "email",
      "term": "tps reports",
      "content": "image link"
    }
  },
  "event": "productViewed",
  "messageId": "ajs-f8ca1e4de5024d9430b3928bd8ac6b96",
  "properties": {
  "currency": "INR",
  "filters": "Price < 5000",
  "sort": "Price (Low to High)",
  "product": {
    "name": "Earbuds",
    "category": "Mobile Phone & Accessories",
    "position": 1
  }
},
  "receivedAt": "2015-12-12T19:11:01.266Z",
  "sentAt": "2015-12-12T19:11:01.169Z",
  "timestamp": "2015-12-12T19:11:01.249Z",
  "type": "track",
  "originalTimestamp": "2015-12-12T19:11:01.152Z",
  "writeKey": "aUL2rZghe5jHvjWh"
}

Event

Every single action recorded via track API call is called an event. The event name should specify the action performed by the user. We follow camelCase standard while naming the events. The name of the event should be semantically correct for a better understanding of everyone. For example, you should always name your event such as productSearched or registerButtonClicked instead of event123 or rBClk.

Properties

With each track event call, you can attach extra bits of information such as user details, action details, product details etc. This extra information is known as event properties or just properties. The properties are passed with track event in a JSON type format during the call.

In the above JavaScript example, the object after "productViewed" contains the properties passed for that track event. We support string, number, boolean and object (hash) as data types in properties.

Propagating events to destinations

All the track events collected from various sources will by default get passed on to the destinations that you've mapped unless specified the events that should not be passed. We'll pass the event and event properties to the destinations provided if they support it. If a particular destination doesn't support properties, we'll only send event names and vis-à-is, if a destination doesn't support a data type in properties, we'll either convert it or exclude it from sending, whichever's feasible.

Last updated