Tracking
Server side tracking
Overview
This document outlines the process for sending event tracking data to Dema from the server-side. It covers the setup for tracking both pageview and order events via HTTP requests, ensuring you can effectively track user interactions without relying on client-side mechanisms.
Requirements to setup server side tracking
Before integrating Dema scripts into your website, ensure the following prerequisites are met:
- Ecommerce System Matching: The product ID should match the one in your ecommerce system.
- Dema ID: You need 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:
Order Event
For an order event, include detailed order information:
Examples of Curl Requests
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.