Bulk collecting user identity and features usage


Bulk collecting user identity and features usage

# Overview

In order to send a set of events in a batch job, you can call our /bulk endpoint. It allows to send any kind of event as a simple JSON array.

The code below allows to collect by batch the identification and features usage:

curl -G --location \
--request POST "https://collect.skalin.io/hit/bulk?rec=1&client_id={{ClientId}}" \
--header "Content-Type: application/json" \
--data-raw "{
    \"identities\": [
        {
            \"eventId\": \"{{EventId}}\",
            \"identity\": {
                \"email\": \"{{UserEmail}}\",
                \"id\": \"{{UserId}}\"
            },
            \"customerId\": \"{{CustomerId}}\",
            \"visitId\": \"{{VisitId}}\",
            \"ts\": \"{{ts}}\",
            \"localtime\": \"{{LocalTime}}\",
            \"url\": \"{{Url}}\",
            \"cip\": \"{{Cip}}\"
        },
        ...
    ],
    \"features\": [
        {
            \"eventId\": \"{{EventId}}\",
            \"name\": \"{{FeatureName}}\",
            \"identity\": {
                \"email\": \"{{UserEmail}}\",
                \"id\": \"{{UserId}}\"
            },
            \"customerId\": \"{{CustomerId}}\",
            \"visitId\": \"{{VisitId}}\",
            \"ts\": \"{{ts}}\",
            \"localtime\": \"{{LocalTime}}\",
            \"url\": \"{{Url}}\",
            \"cip\": \"{{Cip}}\"
        },
        ...
    ]
}"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

With NodeJS and axios (opens new window) library

await axios({
  method: 'POST',
  url: 'https://collect.skalin.io/hit/bulk',
  headers: {
    'Cache-Control': 'no-cache',
    'Content-Type': 'application/json'
  },
  params: {
    rec: 1,
    client_id: '2bb91c92dr779103',
  },
  data: {
      identities: [
          {
            eventId: "sqfdpolsijrfitof",
            identity: {
                email: "dds@sdsd.com"
            },
            customerId: "customer1234",
            visitId: "9c915a48e71cdd42",
            ts: "2021-05-08T12:00:05",
            localtime: "08:00:05",
            url: "https://docs.skalin.io/en/dev/tracking/1.0.0/sst/identity/#use-of-user-email",
            cip: "127.0.0.1"
          }
      ],
      features: [
          {
            eventId: "sqfdpolsijrfitof",
            name: "feat1",
            identity: {
                email: "dds@sdsd.com"
            },
            customerId: "customer5678",
            visitId: "9c915a48e71cdd42",
            ts: "2021-05-08T12:00:05",
            localtime: "08:00:05",
            url: "https://docs.skalin.io/en/dev/tracking/1.0.0/sst/identity/#use-of-user-email",
            cip: "127.0.0.1"
          }
      ]
  }
});

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ClientId

your client ID which was provided to you by Skalin or is available in the Settings> General section

CustomerId (optional) customer identifier or customer domain name (the CustomerId is only useful if the same contact can connect to several entities with the same identifier)
EventId (optional / auto-generated) Event's unique identifier of 16 characters. Allows you to manage de-duplication (The last transmitted will be kept).
VisitId (optional but recommended. If not defined, auto-generated and all events will have the same visit ID for this request) Visit or session's unique identifier. 16 character uid (used to count visits. If VisitId is not filled in or is different for each call, each call will be counted as a new visit).
ts (optional) event timespan with YYYY-MM-DDTHH:mm:ss format (By default, timespan is initialized with current server time)
LocalTime (optional) User's localtime (`08:00:05`)
UserEmail Logged user's email already referenced in Skalin
UserId Logged user's ID already referenced in Skalin
FeatureName Feature used's name
Url (optional) Feature's url on your platform
Cip (optional) User's ip

Warning

Each type of event (identies, features) cannot contain more than 100 elements

Info

CustomerId corresponds to the refId API's property (Customer ID field of the customer editing interface)

# Endpoint rate limits

The number of requests per seconds accepted from a given IP on collect.skalin.io endpoint is:

  • Nominal rate limit: 100 rqps
  • Burst rate limit: 500 rqps
Contributors: Julien