Skip to content

Events SDK


date: "2023-09-05" Author: "Sinisa Jovic"


How to integrate?

  1. Login into your Sais instance
  2. Go to Data integration section
  3. Select Event SDK tab and click Set Events SDK
  4. Select if you want to collect personal data or not and copy the snippet to clipboard. You can copy the snippet from below code blocks too.
  5. Set the snippet on every page of your website
Collect Personal Data
<script>
!(function (e, t, n, p, o, a, i, s, c) {
   e[o] ||
      (((i = e[o] =
      function () {
         i.process ? i.process.apply(i, arguments) : i.queue.push(arguments);
      }).queue = []),
      (i.t = 1 * new Date()),
      ((s = t.createElement(n)).async = 1),
      (s.src =
      'https://events-scripts.thingsolver.com/v1/script.js?t=' +
      864e5 * Math.ceil(new Date() / 864e5)),
      (c = t.getElementsByTagName(n)[0]).parentNode.insertBefore(s, c));
})(window, document, 'script', 0, 'ts', true),
ts('init', 'dev', { env: 'prod', endpoint: 'https://events.thingsolver.com/api/latest/events/sdk/collect', shouldCollect: true }),
ts('event', 'page-load');
(function (l, s, c) { s = document.createElement('script'); s.src = l; s.onload = c; document.head.appendChild(s); })('https://events-scripts.thingsolver.com/v1/products.min.js', function () { setup('https://events-scripts.thingsolver.com/mappings/dev/cache.json', 'https://events-scripts.thingsolver.com/mappings/dev/mappings.json') });
</script>
<script src="https://events-scripts.thingsolver.com/custom/dev/custom.js?t=" async defer></script>
DON'T Collect Personal Data
<script>
!(function (e, t, n, p, o, a, i, s, c) {
   e[o] ||
      (((i = e[o] =
      function () {
         i.process ? i.process.apply(i, arguments) : i.queue.push(arguments);
      }).queue = []),
      (i.t = 1 * new Date()),
      ((s = t.createElement(n)).async = 1),
      (s.src =
      'https://events-scripts.thingsolver.com/v1/script.js?t=' +
      864e5 * Math.ceil(new Date() / 864e5)),
      (c = t.getElementsByTagName(n)[0]).parentNode.insertBefore(s, c));
})(window, document, 'script', 0, 'ts', true),
ts('init', 'dev', { env: 'prod', endpoint: 'https://events.thingsolver.com/api/latest/events/sdk/collect', shouldCollect: false }),
ts('event', 'page-load');
(function (l, s, c) { s = document.createElement('script'); s.src = l; s.onload = c; document.head.appendChild(s); })('https://events-scripts.thingsolver.com/v1/products.min.js', function () { setup('https://events-scripts.thingsolver.com/mappings/dev/cache.json', 'https://events-scripts.thingsolver.com/mappings/dev/mappings.json') });
</script>
<script src="https://events-scripts.thingsolver.com/custom/dev/custom.js?t=" async defer></script>

You can find a snippet in section CONFIGURE, subsection Data.

What events will be collected?

Default events:

  • page-load
  • page-close
  • focus
  • link

Optional events:

  • email
  • phone

Expanding on events

  • Focus event – It's fired every time the website user stops looking at the website page
  • Link event - It's fired if a link was clicked in the last 5 seconds that goes to an external host (leaving to some other website)
  • Email event - It's fired when a website visitor is leaving the page and he/she has entered in any input a valid email address.
  • Phone event - It's fired when a website visitor is leaving the page and he/she has entered in any input a valid phone number.

What data is being collected

Key Meaning
_tsf_cl Cookie Long
_tsf_cs Cookie Short
ua User Agent
u URL
t Timestamp
p Path
r Referrer
h Host
hn Host Name
scr_ah Available Height on Screen
scr_aw Available Width on Screen
scr_h Screen Width
scr_w Screen Height
e Event Type
ev Environment Type
dt Document Title
dn Domain Name
uid Client ID from Snippet
em Email
pn Phone
fs Focus in Seconds
c Custom Data
csid All Keys from Custom

Cookie short expires if a visitor doesn’t have any interaction with website for 20 minutes As long the user interacts with the website the exparation of the cookie resets to 20 minutes.

Back to top