Collecting features usage


Collecting features usage

Knowing what are the features used by a client on your platform allows me to know his level of involvement or his autonomy. In order to collect this information, you must call Skalin's servers.

The code below is used to collect feature usage of your platform:

curl -G --location \
--request POST 'https://collect.skalin.io/hit' \
--data-urlencode 'rec=1' \
--data-urlencode 'action=ev' \
--data-urlencode 'client_id={{ClientId}}' \
--data-urlencode 'customer_id={{CustomerId}}' \
--data-urlencode 'event_id={{EventId}}' \
--data-urlencode 'visitor_id={{VisitorId}}' \
--data-urlencode 'visit_id={{VisitId}}' \
--data-urlencode 'localtime={{LocalTime}}' \
--data-urlencode 'identity={"email":"{{UserEmail}}"}' \
--data-urlencode 'event={"name":"{{FeatureName}}","event_name":"feature"}' \
--data-urlencode 'url={{Url}}' \
--data-urlencode 'cip={{Cip}}'
1
2
3
4
5
6
7
8
9
10
11
12
13
14

With NodeJS and axios (opens new window) library

axios({
  method: 'POST',
  url: 'https://collect.skalin.io/hit',
  headers: {
    'Cache-Control': 'no-cache'
  },
  params: {
    rec: 1,
    action: 'ev',
    client_id: '{{ClientId}}',
    customer_id: '{{CustomerId}}',
    event_id: '{{EventId}}',
    visitor_id: '{{VisitorId}}',
    visit_id: '{{VisitId}}',
    localtime: '{{LocalTime}}',
    identity: {"email":"{{UserEmail}}"}, // {"id":"{{UserId}}"}
    event: {"name":"{{FeatureName}}","event_name":"feature"},
    url: '{{Url}}',
    cip: '{{Cip}}',
    ts: '{{ts}}'
  }
});

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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).
VisitorId Contact / visitor's unique identifier. 16 character uid
VisitId 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).
LocalTime (optional) User's localtime (`08:00:05`)
UserEmail Logged user's email already referenced in Skalin
FeatureName Feature used's name
Url (optional) Feature's url on your platform
Cip (optional) User's ip
ts (optional) event timespan with YYYY-MM-DDTHH:mm:ss format (By default, timespan is initialized with current server time)

Info

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

Contributors: Julien