Tracking and analytics
Tracking and analytics are driven by collecting data about site visitors in real time, as they interact with your app.
Using the Cloud SDK events package, you can collect data about your site visitors in real time. Data collection happens when the visitor performs an action on your site, for example, views a webpage, clicks a button, or submits a SitecoreAI form. In response to these actions, you can capture events and send them with all their data to Sitecore. Then, the collected data becomes available in the various Sitecore apps your organization has access to.
Events
Events represent actions that a site visitor performs in your app. The Cloud SDK lets you capture both standard events that are available out of the box and your own, custom events.
For example, the VIEW event is a standard event that represents a site visitor's action of viewing a webpage. VIEW events are automatically captured in JSS Next.js apps, with no coding required. The VIEW event automatically triggers every time a site visitor loads the page, and then the event with all its data is sent to Sitecore.
Using custom events, you can track a site visitor's interactions with unique elements on your page. For example, you can capture the site visitor's action of clicking a Promo component on your page by creating a custom event and giving it a custom name such as myretailsite:CLICKED_PROMO. You can capture this event every time a site visitor clicks the Promo. Then, the event with all its data is sent to Sitecore.
The data in the events
When an event triggers, all its data is sent to Sitecore. Some of this data is automatically populated, while other data is provided by you when you run the function that sends the event.
Automatically populated data
The following data is automatically populated:
-
The name of the event that triggered, such as
VIEW. -
The Coordinated Universal Time (UTC) date and time when the event triggered.
-
Session data - the device, operating system, and web browser used for visiting the site, and the referrer URL, if any.
-
Geolocation data - city, country, region, and continent information based on the site visitor's IP address. This data is collected once per active session when the site visitor interacts with your app: it is collected from the first event in that session and is not updated again within the same session.
NoteThe session ends as a result of inactivity after a certain amount of time. Session length is determined when a SitecoreAI user creates and assigns site identifiers.
Data provided by you
When you run the function that sends the event, you usually pass certain data to the function in an event data object. This object accepts required and optional data that's intrinsic to the event. For example, when you run the identity function to send an IDENTITY event, you'll usually include the site visitor's email address, first name, and last name in the identity event data object.
In the event data object, you can also include the optional extension data object. The extension data object lets you collect non-essential, custom data about the event. You can include a maximum of 50 custom attributes of your choice in this object. After you send the event, the data in this object becomes available in Sitecore Customer Data Platform (CDP) in the event, but not in the guest profile.
Not every function accepts these parameters. See the reference documentation for the parameters and required and optional data of all the event data objects.
Options for sending events
In the events package, the browser module lets you send events from the browser (client-side tracking), and the server module lets you send them from the server (server-side tracking). You can send events one by one or, when using client-side tracking, queue them and send them later in one go.
Overview of events
Here's an overview of the events you can send to Sitecore:
|
Event |
Description |
Can contain extension data |
Can be queued |
|---|---|---|---|
|
|
A standard event that captures the site visitor's action of viewing a webpage in your app. JSS Next.js apps automatically capture this event, with no coding required. Client-side tracking function: Server-side tracking function: |
|
|
|
|
A standard event that captures, for example, the site visitor's name, email address, and phone number when they sign up for or log in to your app. Client-side tracking function: Server-side tracking function: |
|
|
|
|
A standard event that captures the site visitor's action of viewing or submitting a SitecoreAI form. JSS Next.js apps automatically capture this event, with no coding required. Client-side tracking function: Server-side tracking function: N/A. |
|
|
|
custom |
A custom event that can capture any action you choose to track. For example, clicks on components and how many times a site visitor adds items to their wish list. Client-side tracking function: Server-side tracking function: |
|
|
Viewing the collected data
The collected data is used across your Sitecore apps. You can view some of the data in, for example, analytics dashboards in SitecoreAI.
Behind the scenes, it's Sitecore CDP that captures and stores all the collected data. If you have Sitecore CDP, you can view the data there in full detail using the site visitor's browser IDbrowser ID. You can view the collected data in Sitecore CDP by clicking Guests, and in the Search field, entering the bid: prefix plus the site visitor's browser ID.
For example: bid: a38b230c-11eb-4cf9-8d5d-274e9f344925.

Then, Sitecore CDP lists the guest profile for the site visitor. In the guestguest profile, you can find detailed session and event data about your site visitor.
Working with the collected data
Marketers at your organization can act on the collected data in the various Sitecore apps.
|
Sitecore app |
How to use the data |
|---|---|
|
SitecoreAI |
|
|
Sitecore CDP |
|
|
Sitecore Personalize |
|