Forward the events from your virtual assistant to Google Tag Manager or Google Analytics 4 and report on conversations, leads and appointments.
There are two ways to connect Novaco data to Google Analytics. Pick one — never run both in parallel.
Recommended if you already use GTM. Push events to the data layer and distribute them to any tag.
Use the Google tag (gtag.js) directly on your website to send events straight to GA4.
Which events are available? See the Google Analytics events reference.
GTM distributes events to third parties through tags. To do so, you provide the data in the so-called "data layer". Add a listener for every event you want to use.
<script>
window.addEventListener('autochat_lead_created', function (e) {
try {
dataLayer.push({
"event": e.type,
"autochat_event_details": e.detail.eventData
});
} catch(e) {
// Your error handling if relevant
}
});
</script><script>
window.addEventListener('autochat_lead_created', function (e) {
try {
dataLayer.push({
"event": e.type,
"autochat_event_details": e.detail.eventData
});
} catch(e) {
// Your error handling if relevant
}
});
window.addEventListener('autochat_chat_first_user_interaction', function (e) {
try {
dataLayer.push({
"event": e.type,
"autochat_event_details": e.detail.eventData
});
} catch(e) {
// Your error handling if relevant
}
});
</script>The try-catch is optional error handling — you can leave it as is.
Alongside the events, Novaco provides additional event data such as session_id, chat_type and appointment_type. Create a variable for each one.
Create a trigger for every event you want to act on, then combine triggers and variables in a GA4 tag.
Any Novaco event trigger you add now automatically sends its data to GA4. The same building blocks can be used for other tags, such as a Google Ads lead conversion.
No tag manager? Use the Google tag (gtag.js) implementation. Never run this setup in parallel with Google Tag Manager — if you use GTM, follow the guide above instead.
<script async src="https://www.googletagmanager.com/gtag/js?id=G-12345678"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-12345678');
</script>Replace G-12345678 with your own measurement ID.
Add this snippet after your gtag('config', ...) call.
<script>
window.addEventListener('autochat_lead_created', function (e) {
try {
gtag('event', e.type, {
'session_id': e.detail.eventData.session_id,
'appointment_type': e.detail.eventData.appointment_type
});
} catch(e) {
// Your error handling if relevant
}
});
window.addEventListener('autochat_chat_first_user_interaction', function (e) {
try {
gtag('event', e.type, {
'session_id': e.detail.eventData.session_id,
'chat_type': e.detail.eventData.chat_type
});
} catch(e) {
// Your error handling if relevant
}
});
</script>e.type automatically resolves to the event name, for example autochat_lead_created. That is also the event name you will see in GA4. Everything after it are the event parameters.
To report on the event parameters, register them as custom dimensions in GA4.
analyticsSetup.dimensions.note
Every event, when it fires and which data it carries.
View the events reference