Reporting & Analytics

ilporyynanen
Membre

Populating datalayer variables with page data

Résolue

Hi everyone,

 

I am trying to populate datalayer variables in thank you page template with page data. I have already managed to do so with contact properties like this:

 

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'formSubmissionSuccess',
'contactId' : {{contact.id}}
});
</script>

 

But I have not managed to include data from the page itself. I would wish it to be something like this:

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'formSubmissionSuccess',
'pageTitle' : {{page title here}},

'pageUrl': {{page url here}}

});
</script>

Also any other page related data would be great.

 

Also I would be interested in passing data to the datalayer with the form values when a form has been submitted and assuing the next page would be thank you page where we could use and send data to various platforms.

 

Are there ready-made variables in Hubspot which I could use or does this require custom coding?

Thank you for your time,

Ilpo Ryynänen

0 Votes
1 Solution acceptée
Kevin-C
Solution
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Populating datalayer variables with page data

Résolue

Thanks @sharonlicari 

 

Hey @ilporyynanen 

 

This documentation has the hubl variables for your all accessible current page data.

 

For page URL use "request.full_url" and for the title use "page_meta.html_title"

 

Hope this gets you moving

Kevin Cornett - Sr. Solutions Architect @ BridgeRev

Voir la solution dans l'envoi d'origine

2 Réponses
sharonlicari
Gestionnaire de communauté
Gestionnaire de communauté

Populating datalayer variables with page data

Résolue

Hey @ilporyynanen 

 

Thank you for sharing this information. I'll tag a few experts that can share their experiences with you.

 

Hey @Kevin-C @Aakar @Joe-Kelp any tip or advice you can share with @ilporyynanen?

 

Thank you

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Votes
Kevin-C
Solution
Expert reconnu | Partenaire solutions
Expert reconnu | Partenaire solutions

Populating datalayer variables with page data

Résolue

Thanks @sharonlicari 

 

Hey @ilporyynanen 

 

This documentation has the hubl variables for your all accessible current page data.

 

For page URL use "request.full_url" and for the title use "page_meta.html_title"

 

Hope this gets you moving

Kevin Cornett - Sr. Solutions Architect @ BridgeRev