Marketing Integrations

MarcoPapavero
Member

Is it possible to send trigger data (clicks) from Google Tag Manager to Hubspot contacts?

SOLVE

Hello Hubspot Community,

I need your support to send data about clicks from Google Tag Manager triggers to Hubspot contacts.

Specifically, I need a JS or some integration among Hubspot and Google Tag Manager that allows me to set a tag in Google Tag Manager to count and visualize in Hubspot who has clicked and where.

The concept is very similar to what this JS script does for the forms:

<script type="text/javascript">
window.addEventListener("message", function(event) {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted') {
window.dataLayer.push({
'event': 'hubspot-form-success',
'hs-form-guid': event.data.id
});
}
});
</script>

The code you will post here to help me, it will insert as tag in Google Tag Manager.

Thanks for your help.

0 Upvotes
1 Accepted solution
Syeda_Fatima
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Is it possible to send trigger data (clicks) from Google Tag Manager to Hubspot contacts?

SOLVE

Hi @MarcoPapaveroto send data about clicks from Google Tag Manager triggers to Hubspot contacts to set a tag in Google Tag Manager to count and visualize in Hubspot for the clicked visitors, you can either use this:

<script>
window.addEventListener("message", function(event) {
if(event.data.type === 'click' && event.data.eventName === 'onClicked') {
window.dataLayer.push({
'event': 'hubspot-click-success',
'hs-click-guid': event.data.id
});
}
});
</script>

                                                                                                Or

 

This:

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'hubspot-click',
'hs-click-guid': {{Click Element ID}}
});
</script>

Hope it helps!

View solution in original post

1 Reply 1
Syeda_Fatima
Solution
Contributor | Diamond Partner
Contributor | Diamond Partner

Is it possible to send trigger data (clicks) from Google Tag Manager to Hubspot contacts?

SOLVE

Hi @MarcoPapaveroto send data about clicks from Google Tag Manager triggers to Hubspot contacts to set a tag in Google Tag Manager to count and visualize in Hubspot for the clicked visitors, you can either use this:

<script>
window.addEventListener("message", function(event) {
if(event.data.type === 'click' && event.data.eventName === 'onClicked') {
window.dataLayer.push({
'event': 'hubspot-click-success',
'hs-click-guid': event.data.id
});
}
});
</script>

                                                                                                Or

 

This:

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'hubspot-click',
'hs-click-guid': {{Click Element ID}}
});
</script>

Hope it helps!