Supported event types
The V2 API expects at minimum the following event types:page_view
Page visits across your site
view_item
Product details page
purchase
Purchase transactions
view_item_list
Product list viewed
select_item
Item selected from a list
add_to_cart
Item added to cart
remove_from_cart
Item removed from cart
view_cart
Cart page viewed
add_to_wishlist
Item added to wishlist
remove_from_wishlist
Item removed from wishlist
begin_checkout
Checkout started
event_name value beyond the ones listed above, and Dema can build custom metrics on top of it. The available fields per event are defined by the event data schema.
Prerequisites
- Your unique Dema ID, formatted as
DV-XXXXXXXXXXXXXXXXXXXXXXXX
Response
The API returns an HTTP200 status code with an empty response body on success.
Request details
Endpoint
- URL:
https://tracker.dema.ai/api/track
HTTP methods
Both GET and POST methods are supported.Required request parameters
| Parameter | Description |
|---|---|
i | Your unique Dema ID. |
uid | Unique user ID for the event, a UUID managed server-side. Must be a valid UUIDv4 string. Should remain consistent across events for the same user. |
_nc | No-cache parameter. Current timestamp in milliseconds since epoch. |
v | Version of your tracking integration (e.g., "2.0.0"). Use your own versioning scheme. |
Event details
For GET requests, event details are passed as a URL-encoded JSON string in them query parameter.
For POST requests, event details are sent as a JSON body with the Content-Type: application/json header.
Event details must conform to the TrackedEventData schema. See the Event data schema reference section for the full schema and field descriptions.
Event examples
page_view
A basic page view event:curl examples for page_view
curl examples for page_view
view_item
Sent when a user views a product detail page:On a product display page, you should send both a
page_view event and a view_item event. This is different from the deprecated V1 API, where a single pageview event covered both.curl examples for view_item
curl examples for view_item
purchase
A purchase event, sent when a user completes a transaction:curl examples for purchase
curl examples for purchase
view_item_list
Sent when a user views a list of products (e.g., a category page or search results):curl examples for view_item_list
curl examples for view_item_list
select_item
Sent when a user selects a product from a list (e.g., a category page or search results). Theindex reflects the position where the item was presented to the user:
curl examples for select_item
curl examples for select_item
add_to_cart
Sent when a user adds a product to their cart:curl examples for add_to_cart
curl examples for add_to_cart
remove_from_cart
Sent when a user removes a product from their cart:curl examples for remove_from_cart
curl examples for remove_from_cart
view_cart
Sent when a user views their shopping cart:curl examples for view_cart
curl examples for view_cart
add_to_wishlist
Sent when a user adds a product to their wishlist:curl examples for add_to_wishlist
curl examples for add_to_wishlist
remove_from_wishlist
Sent when a user removes a product from their wishlist:curl examples for remove_from_wishlist
curl examples for remove_from_wishlist
begin_checkout
Sent when a user starts the checkout process:curl examples for begin_checkout
curl examples for begin_checkout
Event data schema reference
The event detail payload must conform to the TrackedEventData schema. Below is a summary of the available fields.View full TrackedEventData JSON schema
View full TrackedEventData JSON schema
Event fields
Required fields
Required fields
Name of the tracked event (e.g.,
page_view, view_item, purchase).Page & navigation fields
Page & navigation fields
Client & location fields
Client & location fields
User agent string of the client sending the tracked event.
IP address of the client. Used to resolve location fields if not provided explicitly.
Two-letter ISO 3166-1 alpha-2 country code. When provided, overrides the country resolved from the IP address.
Region (state/province). When provided, overrides the region resolved from the IP address.
City. When provided, overrides the city resolved from the IP address.
ZIP/postal code. When provided, overrides the ZIP/postal code resolved from the IP address.
Latitude coordinate. When provided, overrides the latitude resolved from the IP address.
Longitude coordinate. When provided, overrides the longitude resolved from the IP address.
Event detail fields
Event detail fields
Identifier of the order associated with the tracked event.
Identifier of the customer. Typically an email address, but can be any consistent identifier.
Three-letter ISO 4217 currency code (e.g.,
EUR, USD).Total value of the transaction, including items, tax, and shipping.
Total tax amount for the transaction including shipping tax.
Shipping cost for the transaction including tax.
Payment provider used for the transaction.
Shipping provider used for the transaction.
Identifier of the shopping cart.
Identifier of the wishlist.
List of items associated with the event. See item fields below.
List of vouchers applied to the transaction. See voucher fields below.
Custom attributes
Custom attributes
Custom attributes for event-level data.
Item fields (items[])
Required fields
Required fields
Product identifier used for identifying the product in the external system.
Optional fields
Optional fields
Index of the item line in the tracked event. Event context specific — e.g., in
select_item it represents the item’s position in the list; in add_to_cart it represents the item’s position in the cart.Identifier of the specific product variant.
Quantity of the item line.
Price of a single item unit.
Warehouse associated with the item.
Custom attributes for item-level data.
Voucher fields (vouchers[])
Required fields
Required fields
The voucher’s redemption code.
Additional notes
- Ensure all URL parameters are properly URL-encoded when using GET requests.
- The
uid(unique user ID) must be managed server-side. This ID should be a valid UUIDv4 and remain consistent across events to accurately track user behavior.

