api-event_track

This is the template API for event tracking.

URL request

API Track Event

POST https://a.cdp.asia/event?portal_id=PORTAL_ID&prop_id=INSIGHT_PROPERTY_ID&resp_type=RESPONSE_TYPE&is_s2s=[true|false]

In more detail these common params for each API call

Query Parameters

Name
Type
Description

redirect_url

string

When param resp_type is redirect nd event tracking is click then redirect_url should be use.

resp_type

string

Support that types: javascript, json, redirect, pixel. Default is javascript

portal_id

integer

Your business Account ID on the analytics system.

prop_id

integer

Your datasources ID on the analytics system such property as of Web , App Android, App IOS, POS,...

Request Body

Name
Type
Description

context

object

Context properties data for events has describe detail bellowing.

extra

object

Extra properties data for event has described on bellowing **

dims

object

The relation items on events as shop, warehouse, payment method, delivery method...

items

array

List items on events as: products

ea

string

Event action

ec

string

Event category

sid

integer

Hash any ID your users session on visiting your application and caching on SDK of device. default expired after 30 minutes over a session

aid

string

The device advertising ID as: AAID, IDFA

uid

string

You can set to anonymous User ID

_event_callback_data({"dgs":"1576222588%3A3%3A0","au_gt":"1571290715","pv_id":"1576222602739-7","n_client_id":0,"session_id":"6320","n_user":0,"au_id":"7","type":"event","aid":"7","client_id":"7.1558521539","an_session":"zlzgzhzjzdzkzdzizmzkzlzhzhzhzmzrzrzdzgzdzizmzkzlzhzhzhzlzjzhzdzizmzkzlzhzhzhzlzjzhzdzhzdzhzqzdzizd2f27zdzjzdzlzmzlzkzjzd"});

Set request headers

// Some code
Accept-Charset: ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6
Content-Type: application/json

Data payload template

{
  "uid": "USER_ID",
  "sid": "SESSION_ID",
  "ec": "EVENT_CATEGORY",
  "ea": "EVENT_NAME",
  "et": "EVENT_TIME_FORMAT_[yyyy-MM-dd hh:mm:ss]",
  "items":[{list_product_properties}],
  "extra":{extra-properties},
  "context": {context-properties}
}
extra-propertiesproduct-propertiescontext-properties

Data payload sample

{
  "uid": "97980cfea0067",
  "sid": "123456789",
  "ec": "product",
  "ea": "purchase",
  "items":[{
    "type": "product",
    "id":"864115",
    "sku":"5261971730647",
    "quantity":1,
    "brand":"Samsung",
    "original_price":4500000,
    "price":4500000,
     "main_category":"Điện Tử - Điện Lạnh",
     "category_level_1":"Tivi",
     "category_level_2":"Tivi samsung"
    }
 ],
 "extra":{
    "order_id":"977895452",
    "revenue":14500000,
    "num_item":4,
    "discount_amount":45000,
    "promotion_code":""
 },
  "context": {
    "app": {
      "name": "InitechGlobal",
      "version": "545",
      "build": "3.0.1.545"
    },
    "campaign": {
      "name": "Email Campaign Loyalty T12",
      "source": "Newsletter",
      "medium": "email",
      "term": "tps reports",
      "content": "image link"
    },
    "device": {
      "id": "B5372DB0-C21E-11E4-8DFC-AA07A5B093DB",
      "advertisingId": "7A3CBEA0-BDF5-11E4-8DFC-AA07A5B093DB",
      "adTrackingEnabled": true,
      "manufacturer": "Apple",
      "model": "iPhone7,2",
      "name": "sudoku's phone",
      "type": "ios" // android,...
    },
    "ip": "8.8.8.8",
    "library": {
      "name": "analytic sdk android",
      "version": "2.11.1"
    },
    "locale": "en-US",
    "geo": {
      "city": "Ho Chi Minh",
      "country": "Viet Nam",
      "latitude": 40.2964197,
      "longitude": -76.9411617
    },
    "network": {
      "bluetooth": false,
      "carrier": "Viettel",
      "cellular": true,
      "wifi": false
    },
    "os": {
      "name": "iPhone OS",
      "version": "8.1.3"
    },
    "page": {
      "path": "/academy/",
      "referrer": "",
      "search": "",
      "title": "Analytics Academy",
      "url": "https://demox.com/academy/"
    },
    "navigation": "thankyou",
    "referrer": {
      "id": "ABCD582CDEFFFF01919",
      "name": "facebook.com",
      "type": "social"
    },
    "screen": {
      "width": 320,
      "height": 568
    },
    "timezone": "Asia/Ho_Chi_Minh",
    "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
  }

}

Last updated

Was this helpful?