CTRLK

Shared components

Web SDK

|

View as Markdown

Track custom events with the Web SDK by installing the JavaScript library on your website. For event naming and tracking guidelines, see Events best practices.


Install the library

Before you start installing the library, we recommend you review the Web SDK documentation to learn more about how the Web SDK works and see the various methods available to you.

To use the Web SDK:

  1. Create an API key with the Web SDK role enabled.
  2. Visit the Manage API Keys page on the web interface to create your API key.
  3. Once you have created your API key, edit the code to replace "Your API Key" in the pe.init() call with your actual key.

Try it out

After installing the library, you can test event tracking:

  1. Select an event from the dropdown menu.
  2. Select a person from the dropdown menu.
  3. Select Send event.

This allows you to verify that your Web SDK integration is working correctly before deploying to production.


Person activity events

The Web SDK automatically tracks the following person activity events on your website.

Session started

Logs when a person visits your website.

PropertyDescription
Session IDUnique session identifier
Session startTime when the session started (DD/MM/YYYY HH:MM:ss)
Session typeWeb
UTM parametersutm_source, utm_medium, utm_campaign, utm_term, utm_content. If no UTM tags are set, utm_source defaults to direct.

Page view

Logs when a person views a page on your website.

PropertyTypeDescription
pageTitleStringTitle of the current page
urlStringURL of the page (max 1,500 characters)
domainStringDomain portion of the URL
pathStringPath portion of the URL
deviceTypeStringDevice type: unknown, mobile, tablet, desktop, spider, TV, console
timestampDateTimeTime when the interaction occurred
browserNameStringBrowser name (e.g., Chrome, Firefox)
browserVersionStringBrowser version
browserOSStringOperating system (e.g., Windows, Linux)
referrerStringReferrer HTTP header
browserLanguageStringBrowser language
websiteLanguageStringWebsite language

Session ended

Logs when a person stops being active on your website.

PropertyDescription
Session IDUnique session identifier
Session EndTime when the session ended (DD/MM/YYYY HH:MM:ss)
Session LengthDuration in seconds
Session TypeWeb
Ended By TypeUSER or SYSTEM
UTM parametersutm_source, utm_medium, utm_campaign, utm_term, utm_content. If no UTM tags are set, utm_source defaults to direct.

Person created

Logs when a person profile is created.

Person merged

Logs when person profiles are merged.




Was this page helpful?