This article shows you how to start session capture for Session Replay and Heatmaps using events. Some example events include when a modal opens or a user interacts with your site. You can also use events to exclude capturing sessions from your employees.
Before you begin
-
The Events API must already be implemented on your site.
-
You must have Admin permissions to edit your site settings in Contentsquare.
A heatmap screenshot cannot be captured using an event.
It isn't possible to capture a screenshot based on an event, however you can filter Heatmap session data based on an event. When filtering, Contentsquare will show data collected from sessions where users triggered the event at some point during their session. This doesn't mean the Heatmap screenshot will be captured at the moment the event fired.
For A/B testing purposes, ensure the event names you're using are unique to the page being tested.
Setting up session capture targeting with events
1. In the Contentsquare app, go to Sites & Organisations.
2. Click the gear icon to access site settings.
3. Click the Session targeting & tracking section.
4. Select Start capturing sessions on specific pages or when a custom event fires.
5. Enter the event name in the Event field.
This is the event that, when triggered, will start session capture. For example: opened_modal
.
Only alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and dashes
(-) can be used in the event name.
6. (Optional) Click the + icon to add more targeting rules.
Events take priority over other targeting options such as URLs.
If an event is present on a page, it will take priority over other targeting rules present, including URL targeting rules.
7. Click Save changes to confirm.
How to set up events to exclude your employees from session capture
1. In your site's code, define a cookie that is stored for users that are employees.
2. Configure your code to send an event only if the employee cookie isn't present.
For example:
if (isnotEmployee) {
window._uxa.push(["event", "start_contentsquare"]);
}
3. Modify session capture settings in the Contentsquare app, using your event name to start session capture.
Follow the steps in the previous section to help with this.