Reporting & Analytics

ilporyynanen
Membro

Populating datalayer variables with page data

resolver

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 Avaliação positiva
1 Solução aceita
Kevin-C
Solução
Especialista reconhecido(a) | Parceiro
Especialista reconhecido(a) | Parceiro

Populating datalayer variables with page data

resolver

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

Exibir solução no post original

2 Respostas 2
sharonlicari
Gerente da Comunidade
Gerente da Comunidade

Populating datalayer variables with page data

resolver

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 Avaliação positiva
Kevin-C
Solução
Especialista reconhecido(a) | Parceiro
Especialista reconhecido(a) | Parceiro

Populating datalayer variables with page data

resolver

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