If you have the Ticket widget embedded on your website and want to track visits and registrations from it, we offer specific events that allow you to monitor when registration begins and ends. In the example below, we are tracking this in Google Analytics.
Track Registrations from the Ticket Widgets Through Google Analytics
1. Embed the Widget to your Website
2. Embed your Google Tag code to your Website
Log in to your Google Analytics account
Open your Data Stream to copy your Google Tag code. Click here to learn how to create a data stream in Google Analytics.
Paste the code to your website
3. Embed the Script Below to your Website (ES-6 compatible)
<script>
window.addEventListener('message', function(event) {
const data = event?.data;
const origin = 'https://www.accelevents.com';
if (!data?.eventName || data?.eventDomain !== origin) {
return;
}
// Access the values from the data object
console.log("Event Name:", data.eventName); // 'AE_REGISTRATION_STARTED'
console.log("Timestamp:", data.timeStamp); // 1730116561570
console.log("Message:", data.message); // 'Registration Started'
console.log("Event Domain:", data.eventDomain); // 'https://www.accelevents.com'
//send event data to gtag
gtag('event', data?.eventName)
});
</script>
When all the scripts are added, visit your website and register for the event through the widget to test it. In your Google Analytics Reports > Realtime Overview, you'll see that AE_REGISTRATION_STARTED and AE_REGISTRATION_COMPLETED are tracked.
In the example below, the page with the widget loaded was visited twice, and 1 user completed a purchase through the widget.
Events tracked through the script:
AE_REGISTRATION_STARTED - triggers when the widget loads on the page
AE_REGISTRATION_COMPLETED - triggers when the purchase is done
AE_REGISTRATION_TIMED_OUT - triggers when the timer runs out during registration
AE_REGISTRATION_FAILED - triggers when the user tries to pay for the purchase but fails.
ES-5 Compatible Script
If you're using ES-5 for your site (older JavaScript version), please use the script below:
<script>
window.addEventListener('message', function(event) {
var data = event && event.data;
var origin = 'https://www.accelevents.com';
if (!data || !data.eventName || data.eventDomain !== origin) {
return;
}
// Access the values from the data object
console.log("Event Name:", data.eventName); // 'AE_REGISTRATION_STARTED'
console.log("Timestamp:", data.timeStamp); // 1730116561570
console.log("Message:", data.message); // 'Registration Started'
console.log("Event Domain:", data.eventDomain); // 'https://www.accelevents.com'
// Send event data to gtag
gtag('event', data.eventName);
});
</script>