Skip to main content

Supported data types

Pageviews

Product page visits

Orders

Purchase transactions

Prerequisites

  • The product ID must match the one in your e-commerce system
  • Your unique Dema ID, formatted as DV-XXXXXXXXXXXXXXXXXXXXXXXX

Request details

Endpoint

  • URL: https://tracker.dema.ai/track.js

HTTP method

  • Method: GET

Headers

  • User-Agent: Client’s User Agent string to be included in the request headers.

Request parameters

Common parameters for all events

  • e: Event type. Accepts "pageview" or "order".
  • i: Your unique Dema ID.
  • v: Version of your tracking script (e.g., "1.0.0").
  • uid: Unique user ID for the event, a UUID managed server-side.
  • _nc: Current timestamp.
  • u: The full URL of the page visited.
  • r: The referring URL, if available.

Event-specific parameters

  • m: Additional event data in JSON string format.
Pageview event
For a pageview on a product page, include:
{
  "productId": "1234",
  "ip": "127.0.0.1",
  "country": "SE"
}
Order event
For an order event, include detailed order information:
{
  "order": {
    "orderId": "1234ORDER",
    "total": "99.02",
    "shipping": "13.03",
    "currency": "EUR",
    "tax": "23.00",
    "voucher": "",
    "products": [
      {
        "id": "1234",
        "productId": "12345",
        "price": "1239.0",
        "quantity": 1
      }
    ],
    "customer": {
      "idFields": {
        "customerId": "[email protected]"
      }
    }
  },
  "ip": "127.0.0.1",
  "country": "SE"
}

Examples of curl requests

curl 'https://tracker.dema.ai/track.js?e=pageview&m=%7B%22productId%22%3A%221234%22%2C%22ip%22%3A%22127.0.0.1%22%7D&u=https%3A%2F%2Fexample.com&i=YOUR-DEMA-ID&v=1.0.0&uid=YOUR-UUID&_nc=YOUR-TIMESTAMP' \
-H 'User-Agent: CLIENT-USER-AGENT'
Replace placeholder values (YOUR-DEMA-ID, YOUR-UUID, YOUR-TIMESTAMP, and CLIENT-USER-AGENT) with actual data specific to your implementation.

Additional notes

  • Ensure all URL parameters are properly URL-encoded. The examples provided have been encoded accordingly.
  • The management of the unique user ID (uid) must be handled server-side. This ID should be consistent across different events to track user behavior accurately.