Web SDK
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:
- Create an API key with the Web SDK role enabled.
- Visit the Manage API Keys page on the web interface to create your API key.
- 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:
- Select an event from the dropdown menu.
- Select a person from the dropdown menu.
- 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.
| Property | Description |
|---|---|
| Session ID | Unique session identifier |
| Session start | Time when the session started (DD/MM/YYYY HH:MM:ss) |
| Session type | Web |
| UTM parameters | utm_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.
| Property | Type | Description |
|---|---|---|
| pageTitle | String | Title of the current page |
| url | String | URL of the page (max 1,500 characters) |
| domain | String | Domain portion of the URL |
| path | String | Path portion of the URL |
| deviceType | String | Device type: unknown, mobile, tablet, desktop, spider, TV, console |
| timestamp | DateTime | Time when the interaction occurred |
| browserName | String | Browser name (e.g., Chrome, Firefox) |
| browserVersion | String | Browser version |
| browserOS | String | Operating system (e.g., Windows, Linux) |
| referrer | String | Referrer HTTP header |
| browserLanguage | String | Browser language |
| websiteLanguage | String | Website language |
Session ended
Logs when a person stops being active on your website.
| Property | Description |
|---|---|
| Session ID | Unique session identifier |
| Session End | Time when the session ended (DD/MM/YYYY HH:MM:ss) |
| Session Length | Duration in seconds |
| Session Type | Web |
| Ended By Type | USER or SYSTEM |
| UTM parameters | utm_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.