Tracking orders and purchases
The below example allows 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
If tracking events via Seeka's Browser SDK alongside using the Seeka HTTP API, the activity ID provided in the HTTP request should match the activity ID used when firing an Order event in the Browser SDK to ensure correct deduplication.
To specify activity ID in browser SDK:
Converge.track.order({
....
currencyCode: 'USD',
totalTax: 87.1,
totalShippingPrice: 12.10
}, {
activityIdentifier: 'order_12345'
});
Sending an order to Seeka
The below tokens in the code example should be replaced with your own values.
Token | Required | Description | Example |
---|---|---|---|
<your organisation ID> | Yes | Your organisation ID or the organisation ID of the Seeka organisation you are sending data on behalf of | |
<your 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. | order_12345 |
<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 |
Node.js - Axios
Node.js - Fetch
PHP - cURL
C# - HttpClient
C# - RestSharp
Go - HTTP Client
const axios = require('axios');async function sendOrderToSeeka(data) {try {// Headersconst headers = {"Content-Type": "application/json","X-OrgId": "<your organisation ID>","X-Converge-Key": "<your 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"]},"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}],"orderIdentifier": "d20e83734528455ca9bc4d82c1ab9ae2","orderNumber": "4515222587","customerIdentifier": "eaf43d8985844fc499af9079a1ff2045","paymentMethodName": "Credit card","currencyCode": "USD","totalPrice": 84},"time": "2023-08-24T14:15:22Z"}}}]};// Send orderawait sendOrderToSeeka(order);