What are Event-Based Website Audiences
After connecting your site to RollWorks by placing our Pixel on your website, we will start capturing your visitor data to turn into Website Audiences. Event-based Website Audiences segment your website traffic based on an event triggered by a visitor, such as a button click, that does not result in a change in URL. To create this audience type, you have to add a JavaScript code snippet to the onClick attribute of your JavaScript button.
When to use an event-based website audience:
- When you want to track an Audience defined by users clicking on a button on your website and clicking the button that does not result in a URL change. If there is a URL change you should track the audience creating a simple URL-based Audience.
- Tracking conversions that need to be completed on a separate website (this is a common scenario for event promotions)
Event-based Website Audiences are triggered when your visitor clicks the button, regardless if there is a subsequent action that is not completed. For example, if you create an Event-based Audience based on the "Submit" button at the end of a form fill, the event will be triggered and the visitor will be added to this audience even if the form is not submitted and returns an error because some required fields were not entered.
Create Event-based Website Audiences
Step 1: In RollWorks, create a URL Visited Audience:
- Log in to RollWorks and Navigate to Audiences > Website Audiences and select Create Audience.
- Select Audience Type = URL Visited.
- Click Copy ID to Clipboard to copy a unique ID to be used as the URL rule placeholder.
- Enter + (plus sign) and then paste your copied ID under URL Visited' matches [ ]
- Enter your desired Audience Name.
- Enter your desired Audience Duration (in days) under How long to keep a person in this audience. If you aren't sure, learn more in our Audience Duration article.
- Only if this audience is a Conversion Audience, check the box labeled This is a conversion audience. If you aren't sure, learn more in our Conversion Audiences Guide.
- Click Create Audience.
Step 2: Create an Audience Pixel JavaScript snippet code
- Create the following JavaScript snippet to tie to your Event-based Audience:
<script type="text/javascript">
try {
__adroll.record_user({"adroll_segments": "segment_ID"});
} catch(err) {}
</script>
- Replace segment_ID in red with the unique ID generated in RollWorks in the prior step of this guide. Your Audience Pixel will look similar to this:
<script type="text/javascript">
try {
__adroll.record_user({"adroll_segments": "c4902250"});
} catch(err) {}
</script>
- Add this Audience Pixel to the onClick function of the button and the page(s) you want to track through this Event-based Audience.
-
As an option, many of our customers place the JavaScript code snippet in an external JavaScript file that gets called during the click event. We strongly suggest that you consult with your website engineering team to determine the best implementation option depending on your website structure.
Troubleshooting
Basic Troubleshooting:
- Ensure that your RollWorks Pixel is active and fires on every page of your website. Your RollWorks Pixel can only detect activity on a page if it is active on that page. Learn more about how to troubleshoot your Pixel in this article.
-
Verify that you added the correct Audience ID to your Audience Pixel javascript snippet code.
-
- Go to Audiences > Website Audiences and find the audience that isn't populating.
- Click Copy ID to Clipboard to copy the unique ID that identifies this Audience.
- Find your Audience Pixel in the HTML code of your website page(s) and paste the ID after adroll_segments:
-
<script type="text/javascript">
try {
__adroll.record_user({"adroll_segments": "c4902250"});
} catch(err) {}
</script>
-
-
- Verify that you have placed the event pixel in the onClick action of your JavaScript button.
-
Advanced Troubleshooting:
Below are Advanced troubleshooting steps you can take to confirm if the dedicated Pixel for an event-based website audience is firing correctly. These instructions apply only if the user-triggered event that you are troubleshooting reloads the page or directs the user to another URL. If the page does not reload nor directs the user to another URL you should use this PixelPal Guide to troubleshoot your event-based Pixel implementation.
Step 1. Open Chrome Developer Tools:
- Open your Chrome browser
- Go to the URL on your website that has the Event-based audience implemented
- Open Developer Tools by right-clicking your mouse and clicking Inspect
Step 2. Within Chrome Developer Tools:
- Go to the tab Network
- Mark the checkbox Preserve log
-
In the network call search box:
- Type name= → use this option if you DO NOT know the event segment EID or snippet pattern ID
-
Enter the event segment EID → use this option if you know the event segment EID
- Perform a conversion test by clicking the button that you are tracking with this Event-based Audience.
- You will see the network calls under the “Name” column → click the adroll call
-
You can confirm the Event-based pixel is firing correctly in a couple of ways:
- Option a) Click Headers → General → Request URL → search for “name=[snippet pattern ID]”
-
-
Option b) Click Headers → General → Response Headers → search for the segment details:
- x-segment-display-name: name of your audience segment.
- x-segment-eid: audience segment EID.
- x-segment-name: snippet pattern ID.
-
Option b) Click Headers → General → Response Headers → search for the segment details: