Conversion tracking
Due to how the technical solution looks it is not possible to track events using the URL changing nor the actual events that happens within the widget.
The self-assessment exposes events allowing the parent webpage to subscribe to events which fire for page changes or when the user adds data in the process.
Integration with Google Tag Manager
The following example shows integration with Google Tag Manager where window.dataLayer
is being used for "proxying" data into their solution (reference).
It builds on top of the initial integration which must be complete before you can follow this guide.
Example: conversion tracking signup-completed
If the main KPI is conversion based on users completing the full widget flow, ie. providing contact information, one should track the path to become completed
.
window.dataLayer = window.dataLayer || [];
trialbeeWidget.on('action', (action, state) => {
const completePagePath = state.currentPage + (state.subPage ? state.subPage : '');
if (completePagePath === 'completed') {
window.dataLayer.push({
event: 'navEvent',
osa: {
pagePath: '/osa/' + completePagePath,
pageTitle: 'osa: ' + completePagePath,
},
});
}
});
The conversion tracking needs to be continued in Google Ads. Visit Google Ads help to "Set up conversion tracking for your website".
Example: all events
The following example shows every traceable event. This can help you build custom feedback loops and also create custom exit flows when the user closes the widget.
trialbeeWidget.on('action', (action, state) => {
const completePagePath = state.currentPage + (state.subPage ? state.subPage : '');
console.log("action", action);
console.log("navEvent", completePagePath);
console.log("state", state);
if (action === 'pageOpened') {
console.log("👤 User navigated to", completePathPath);
} else {
console.log("👤 Last action was", action);
}
});
If you have any questions, please contact [email protected].