logo

Direct Integration with Connecto’s API

Integrating connecto’s api can help you in personalising your website or app with notifications based on user’s prior actions. With connecto you can track and analyse user’s behaviour and in turn improve visitors engagement.

Connecto tracks user’s events and actions in four ways. These are :

Page Call : Trigger to Page call occurs whenever the url changes or user loads any new page. This call can help us in identifying the number of visitors visiting any particular page.

Track Call : Trigger to Track call will happen for those components of a page for which we want to track user’s actions and what all events they performed. Basically to track user’s events in a page, track call is used.

Identify Call : Identify call triggers whenever there is a new user visiting a web page or if the existing details of any visiting user are updated.

Event Call : Event call triggers whenever a user visit visits or performs some action on mobile application. Depending on the event occurred, call to track or identify api occurs. The payload of event api call comes in a batch of 10, as android handles the events according to components rendered.

In case you want to integrate your backend directly with Connecto’s events you can use our api for the same. The terms required by connecto along with description are as following :

 

anonymousId : This is the unique id generated by connecto
channel : This is used to identify the channel on which the connecto script is running. It can be web or app. This is sent by client.
context : This tells about the url on which the connecto script is integrated. Also the library name and its version number can be known. url: “<web_url>” {library : {name: “<your backend name>”, version: “1.0”}}
event : This is the name of the event for which we want to track user’s action. For eg. Add to Cart event will tell us the count of users who performed Add to Cart operation.
messageId : This is a uuid generated by connecto.
sent at : This tells about the current timestamp at which a call was made. This is generated by connecto.
sessioncount : This helps in identifying if the user is a first time visitor or has visited in the past. Its value is 1 if the user has visited for the first time, else it is 2.
timestamp : This tells about the current timestamp at which a call was made. This is generated by connecto.
type : This is used to identify among the three types of possible calls i.e. page call, track call or identify call. It is sent by client.
user id : This is the unique id generated by connecto.
writekey : This is a secret key generated by connecto to identify the project.
properties/data/traits {
‘key1’: ‘value1’
‘key2’: 100
‘key3’: ‘2018-03-19T08:00:53.995Z’
}

Now we will look at some of the attributes that are unique for each call.

properties : This object is sent by the client to connecto when a track call is made. This object contains all the user defined attributes that are used to track user’s events. For eg, we want to track information about a product, then the properties object can have the following attributes :

"properties":{
"PRODUCT TYPE": "abc",
"PRODUCT NAME": "abc",
"PRODUCT VARIANT": "abc",
"PRODUCT MODEL": "abc"
}

data : This object is sent by the client to connecto when a page call is made. This object consists of all the user defined attributes that are used to identify a particular page. For eg, we want to track information about a particular page, then the data object can have the following attributes :

"data":{
"AUTHOR NAME": "abc",
"PRODUCT TYPE": "abc",
"PRODUCT NAME": "abc",
"PRODUCT VARIANT": "abc",
"PRODUCT MODEL": "abc"
}

traits : This object is sent by the client to connecto when an identify call is made. It contains of all the attributes that are used to identify any user. For eg, traits object can have the following set of attributes :

"traits":{
"$email": "abc@connecto.com",
"$phone": "xxxxxxxxxx",
"$name": "connecto"
}

Note : All of these three objects -> properties/data/traits contain all the required attributes in key-value pairs. Connecto stores and and tracks all the attributes that it receives from the client. It does not perform any filtering and processing on them. So, the client should carefully send only those attributes for which he/she wants the tracking to be done, as connecto tracks all the data it receives.

You can perform the following 4 types of calls :
  1. POST https://api.connecto.io/track
  2. POST https://api.connecto.io/page
  3. POST https://api.connecto.io/identify
  4. POST https://api.connecto.io/event

The data is of the form :
{
"messageId": "8ec8b94f-985e-0288-e8b9-f61c82331882",
"type": "page/track/identify",
"userId": "ee23df09-15c7-3b26-698c-cacc7368c497",
"anonymousId": "ee23df09-15c7-3b26-698c-cacc7368c497",
"timestamp": "2018-03-19T09:18:19.351Z",
"sessioncount": 2,
"context": {
"url": "https://www.cardekho.com/renault/captur/specs",
"utm_param": {},
"library": {
"name": "backend",
"version": "1.0"
}
}
"event": "Test event",
"writeKey": "xxxxxxxxxxxx",
"channel": "web/app",
"sentAt": "2018-03-19T09:18:19.352Z"
}

These attributes are common in all types of calls. Now we will look at those objects which are unique for each call.

"data": {
"PAGE TYPE": "ModelPage.SpecsTab",
"BODY TYPE": "SUV Cars",
"OEM NAME": "Renault",
"MODEL NAME": "Renault Captur"
}

"properties": {
"LeadLocation": "ConnectoExitDCBTimedelayRenaultModelPage.PicturesTab",
"Video Title": "DCB - Time delay - Renault",
"PAGE TYPE": "ModelPage.PicturesTab",
"BODY TYPE": "SUV Cars",
"OEM NAME": "Renault",
"MODEL NAME": "Renault Captur"
}

"traits": {
"$name": "abc",
"$email": "abc@connecto.com",
"$phone": "xxxxxxxxxx"
}

/event : Payload of /event api call is as follows:

 

   
{
  "batch": [
    {
      "messageId": "8caa091d-915d-4252-a723-359f2877600a",
      "type": "identify",
      "channel": "mobile",
      "context": {
        "app": {
          "build": 120,
          "name": "CarDekho",
          "namespace": "com.girnarsoft.cardekho",
          "version": "7.0.6.6"
        },
        "library": {
          "name": "connecto-android",
          "version": ""
        },
        "os": {
          "name": "Android",
          "version": "7.1.1"
        },
        "timezone": "Asia/Kolkata",
        "screen": {
          "density": 2.625,
          "width": 1080,
          "height": 1794
        },
        "userAgent": "Dalvik/2.1.0 (Linux; U; Android 7.1.1; Android SDK built for x86 Build/NYC)",
        "locale": "en-",
        "device": {
          "id": "40fbb1335b6cef24",
          "manufacturer": "Google",
          "model": "Android SDK built for x86",
          "name": "generic_x86"
        },
        "network": {
          "wifi": false,
          "carrier": "Android",
          "bluetooth": false,
          "cellular": true
        }
      },
      "anonymousId": "1ed97665-9d47-4a95-ac56-73e1c6d33efa",
      "userId": "40fbb1335b6cef24",
      "writeKey": "XXXXX",
      "timestamp": "2017-11-21T17:19:28+0530",
      "traits": {
        "First Name": "Test",
        "mobile": "9001022773",
        "userId": "40fbb1335b6cef24"
      }
    },
    {
      "messageId": "97cee42b-3827-4952-a82f-92c254c7a90f",
      "type": "track",
      "channel": "mobile",
      "context": {
        "app": {
          "build": 120,
          "name": "CarDekho",
          "namespace": "com.girnarsoft.cardekho",
          "version": "7.0.6.6"
        },
        "library": {
          "name": "connecto-android",
          "version": ""
        },
        "os": {
          "name": "Android",
          "version": "7.1.1"
        },
        "timezone": "Asia/Kolkata",
        "screen": {
          "density": 2.625,
          "width": 1080,
          "height": 1794
        },
        "userAgent": "Dalvik/2.1.0 (Linux; U; Android 7.1.1; Android SDK built for x86 Build/NYC)",
        "locale": "en-",
        "device": {
          "id": "40fbb1335b6cef24",
          "manufacturer": "Google",
          "model": "Android SDK built for x86",
          "name": "generic_x86"
        },
        "network": {
          "wifi": false,
          "carrier": "Android",
          "bluetooth": false,
          "cellular": true
        }
      },
      "anonymousId": "1ed97665-9d47-4a95-ac56-73e1c6d33efa",
      "userId": "40fbb1335b6cef24",
      "writeKey": "XXXXX",
      "timestamp": "2017-11-21T17:19:28+0530",
      "event": "eventTracking",
      "properties": {
        "eventAction": "clicked",
        "eventCategory": "tabs",
        "vehicleType": "car"
      }
    }
  ],
  "sentAt": "2017-11-21T17:23:47+0530",
  "context": {
    "ip": "115.248.233.98, 115.248.233.98",
    "userAgent": "Dalvik/2.1.0 (Linux; U; Android 7.1.1; Android SDK built for x86 Build/NYC)",
    "browser": {},
    "device": {},
    "os": {
      "name": "Android",
      "version": "7.1.1"
    },
    "engine": {},
    "cpu": {}
  }
}

This is a demo batch showing only 2 requests one each for identify and track. Each batch can consist of maximum 10 requests.

9 found this helpful