Reporting & Analytics

ilporyynanen
Mitglied

Populating datalayer variables with page data

lösung

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 Upvotes
1 Akzeptierte Lösung
Kevin-C
Lösung
Trendsetter/-in | Partner
Trendsetter/-in | Partner

Populating datalayer variables with page data

lösung

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

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten
sharonlicari
Community-Manager/-in
Community-Manager/-in

Populating datalayer variables with page data

lösung

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


Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success.
Don't miss this opportunity to connect and grow—reserve your spot today!

0 Upvotes
Kevin-C
Lösung
Trendsetter/-in | Partner
Trendsetter/-in | Partner

Populating datalayer variables with page data

lösung

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