😎Android/IOS Tracker

Api EndPoints To Track Events From Android/Ios Apps

For Any Queries Drop a mail at : aman@crunchit.ai

Session Id

Session id is generated when user starts new session.

Distinct Id :

Keep distinctid same in different user sessions.It will help in merging event.
That user produced before user identification.

Keep distinctid it in local Storage and if user clears the local storage.
Generate the new distinctid for that user using our api(mentioned below).
  

To Generate Session Id and distinct Id :

curl --location 'https://events-backend-5dzspnb6za-uc.a.run.app/generate-session' \
--header 'project_id;'

Headers :

project_id : apikey (required)

Api Response :

Status Code : 200

{
    "success": true,
    "sessionId": "aae5029b9ab1b817c6a42731cc93ba1c3e9d57a0cb27ab7893c7765359b1fcb6"
}

Track Event

curl --location 'https://events-backend-5dzspnb6za-uc.a.run.app/track/event' \
--header 'project_id: ' \
--header 'Content-Type: application/json' \
--data '{
    "activity" : [{
        "distinctId" : "123",
        "id" : "132", 
        "timestamp" : "1695710198415", 
        "userIntent" : "test ios",
        "anyCustomKey" : "anyCustomValue",
        "utmParameter" : {
            "utm_source" : "",
            "utm_medium" : "",
            "utm_campaign" : "",
            "utm_term" : "",
            "utm_content" : ""
        },
        "ipAddress"  : "",
        "userAgent" : ""
    }]
}'

Headers :

project_id : apikey (required)

Payload

distinctId - to track user before identification.and merge events to with identified user (required),
id - session id (required),
timestamp - event produced time.should be in milliseconds (required), 
userIntent - event name (required),
anyCustomKey - custom properties (optional),
utmParameter - to track from where the traffic is coming { 
    utm_source : (optional),
    utm_medium :  (optional),
    utm_campaign : (optional),
    utm_term : (optional),
    utm_content : (optional)
} - (optional) 
ipAddress - Geolocate the user (optional),
userAgent - to detect browser,device etc (optional)

Extra Points :

  1. keep the object nested level at 1.To add Nested Objects flatten it :

Example : 
Original Object : 
    const payload = {
        "akey" : "aValue"
        "obj" : {
            "prop1" : "prop2"
            ....
        }
        ....
    }

After Flattening : 
   const payload = {
        "akey" : "aValue"
        "obj.prop1" : "prop2"
        ....
    }

Api Response :

Status Code : 201

{
    "success": true,
}

Identify User

curl --location 'https://events-backend-5dzspnb6za-uc.a.run.app/add-relation' \
--header 'project_id;' \
--header 'Content-Type: application/json' \
--data '{
    "uniqueIdentifier": "",
    "id": "",
    "email": "",
    "name": "",
    "anycustomKey" : "anyCustomProp"
}'

Headers :

project_id : apikey (required)

payload :

uniqueIdentifier : user identifier (required),
id - session id (required),
email - emailId (optional),
name - name (optional),
anycustomKey - custom properties (optional) 

Extra Points :

  1. keep the object nested level at 1.To add Nested Objects flatten it :

Example : 
Original Object : 
    const payload = {
        "akey" : "aValue"
        "obj" : {
            "prop1" : "prop2"
            ....
        }
        ....
    }

After Flattening : 
   const payload = {
        "akey" : "aValue"
        "obj.prop1" : "prop2"
        ....
    }

Api Response :

Status Code : 201

{
    "success": true,
}

Last updated