Tracking orders and purchases
This example outlines sending a purchase / order server side to the Seeka API, including the customer details and the products purchased.
Organisation ID and public key can be retrieved from the Seeka app. The public key is Seeka brand specific.
Considerations for software vendors: The organisation ID and public key provided in your request will linked to the Seeka brand you are sending data on behalf of.
Deduplication
The same order often reaches Seeka twice: once from the customer's browser when they complete checkout (via the Browser SDK) and once from your server (via the HTTP API). Seeka uses the activity ID to recognise both fires as the same order, so it is only counted once.
For deduplication to work, the server fire and the browser fire must carry the same value:
| Fire | Field | Where it is set |
|---|---|---|
| Server (HTTP API) | activityId | payload.activityId in the request body |
| Browser (Browser SDK) | activityIdentifier | Options argument of the track method |
Derive the value from the order itself, such as the order ID or order number. Both your server and your browser code can then produce the same value independently for the same order.
activityIdandactivityIdentifiermust be stable across the server and browser fires. Never use a random or time-generated value. If the two fires carry different values for the same order, Seeka cannot relate them and the order is counted twice.
Firing the same order in the Browser SDK, with activityIdentifier set to the same value as activityId in the HTTP request:
Converge.track.order({
....
currencyCode: 'USD',
totalTax: 87.1,
totalShippingPrice: 12.10
}, {
activityIdentifier: 'order_12345' // same value as activityId in the HTTP request
});Specifying the event source
Software integrators sending events server side should include the src object to describe where the activity originally took place, so the event is classified and attributed correctly.
| Property | Description |
|---|---|
method | The mechanism used to deliver the event. Use http when integrating with the HTTP API. |
loc | URL of the page the order originated from, for example the event or product page the customer purchased on. |
origin | Must be set to the constant value server when firing server side. This tells Seeka the event was fired from a server rather than a browser, so the request context of your server (IP address, user agent) is not treated as the customer's browser context. |
time | ISO formatted time the activity occurred. If omitted, the activity time from the payload is used, falling back to the time Seeka received the event. |
Important: when firing server side, always set
originto the constant valueserver.
Sending an order to Seeka
| Token | Required | Description | Example |
|---|---|---|---|
<organisation ID> | Yes | Your organisation ID or the organisation ID of the Seeka organisation you are sending data on behalf of | |
<public key> | Yes | Your public key or the public key of the Seeka brand you are sending data on behalf of | |
<activity ID> | Yes | Unique identifier used to de-duplicate events. This should be the order ID or a unique identifier for the purchase. See Deduplication above. | order_12345 |
<activity time> | Yes | ISO formatted The time the order was placed / created. | 2025-02-24T14:15:22Z |
<source URL> | URL of the page the order originated from, for example the event or product page the customer purchased on. See Specifying the event source below. | https://tickets.yourticketingplatform.com/event/summer-music-festival | |
<seeka profile ID> | Seeka profile ID retrieved from the browser SDK. See retrieving the SeekaPId. Highly recommended | sk.1.1709215400100.4182463348 | |
<integration version> | Version of your software build or the version of your integration. | 1.0.0 | |
<integration name> | Name of your software or the name of your integration. | ticketsaurus | |
<TCF consent> | TCF v2.2 consent string that will replace the existing consent for the identity. | See privacy SDK for formatting and requirements |
const axios = require('axios');async function sendOrderToSeeka(data) {try {// Headersconst headers = {"Content-Type": "application/json","X-OrgId": "<organisation ID>","X-Converge-Key": "<public key>","X-Sdk-Client-Version": "<integration version>","X-Sdk-Client-Type": "<integration name>/server"};const response = await axios({url: 'https://router.seeka.services/api/ingest',method: 'POST',data: data,headers: headers});if(response.status !== 202) {console.error('Unexpected response code when trying to send order to Seeka', response.status);}else {console.log('Completed send order to Seeka');}}catch (error) {console.error('Error when attempting to send order to Seeka', error);}}// Create orderconst order = {"data": [{"ev": {"id": {"seekaPId": "<seeka profile ID>","email": ["jane.doe@gmail.com"],"phone": ["+61422333444"],"firstName": ["Jane"],"lastName": ["Doe"],"address": [{"addressLine1": "Shop 6","addressLine2": "2500 Gold Coast Hwy","locality": "Mermaid Waters","state": "Queensland","stateCode": "QLD","postcode": "4218","country": "Australia","countryCode": "AU"}],"dob": ["1991-04-24"],"privacy": {"tcfConsentString": "<TCF consent>"}},"src": {"method": "http","loc": "<source URL>","origin": "server","time": "<activity time>"},"payload": {"activityName": "Order","activityId": "<activity ID>","commerce": {"products": [{"currencyCode": "USD","productIdentifier": 12345,"variantIdentifier": 1454854719669,"sku": "AU5121","productName": "Long neck t-shirt","variantName": "Green","categoryName": "T-shirts","brandName": "Tees R US","unitPrice": 42,"quantity": 2}],"checkoutIdentifier": "3646074f511748b887f516b6267f8b9c","cartIdentifier": "00839db672e54c2caa154470522fca9e","orderIdentifier": "d20e83734528455ca9bc4d82c1ab9ae2","orderNumber": "4515222587","customerIdentifier": "eaf43d8985844fc499af9079a1ff2045","paymentMethodName": "Credit card","currencyCode": "USD","totalPrice": 84},"time": "<activity time>"}}}]};// Send orderawait sendOrderToSeeka(order);
Batch sending orders to Seeka
Multiple orders can be tracked by providing a maximum of 20 events in the data array in the request payload body.