Ads

Salvoni
Member

tag manager advanced conversions

SOLVE

i neet to set advanced conversions in tag manager, but it can't recognize embedded hubspot form as a form so i can't use tag mager form variable or trace email form data field in the thank you page

0 Upvotes
1 Accepted solution
danmoyle
Solution
Most Valuable Member | Elite Partner
Most Valuable Member | Elite Partner

tag manager advanced conversions

SOLVE

Thanks for the tag @PamCotton!  

 

Hi @Salvoni and welcome to the HubSpot Community. I did a little research, as I haven't personally solved this issue before. Here's what I found. 

 

Setting up advanced conversions in Google Tag Manager for an embedded HubSpot form requires a slightly different approach: Custom Event Tracking. HubSpot forms typically trigger custom events when submitted. You can use these events to track form submissions in Google Tag Manager.

 

Create a Custom Event trigger:

  • Go to Triggers > New > Custom Event
  • Set the Event name to "hubspot-form-submit" (or the specific event name used by your HubSpot form

Create a Data Layer Variable for the email:

  • Go to Variables > New > Data Layer Variable
  • Set the Data Layer Variable Name to "hubspotEmail" (or the specific variable name used by HubSpot)

Create a Google Analytics 4 (GA4) tag for the conversion:

  • Go to Tags > New > Google Analytics: GA4 Event
  • Configure the tag with your GA4 Configuration
  • Set the Event Name (e.g., "form_submission")
  • Add a parameter for the email using your Data Layer Variable

Add custom JavaScript to your website to push the form data to the data layer:

window.addEventListener('message', function(event) {
  if (event.data.type === 'hsFormSubmit') {
    var email = event.data.data.email;
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'hubspot-form-submit',
      'hubspotEmail': email
    });
  }
});

This code listens for the HubSpot form submission event and pushes the email to the data layer.

 

Hopefully that helps a bit!

 

P.S. Here's one of the sources I found with more information.

 

Did my answer help? Please "mark as a solution" to help others find answers. Plus I really appreciate it!


Dan Moyle

HubSpot Advisor

LearningOps | Impulse Creative

emailAddress
dan@impulsecreative.com
website
https://impulsecreative.com/

View solution in original post

0 Upvotes
3 Replies 3
JSmith2238
Member

tag manager advanced conversions

SOLVE

Thank you so much for the information.

0 Upvotes
danmoyle
Solution
Most Valuable Member | Elite Partner
Most Valuable Member | Elite Partner

tag manager advanced conversions

SOLVE

Thanks for the tag @PamCotton!  

 

Hi @Salvoni and welcome to the HubSpot Community. I did a little research, as I haven't personally solved this issue before. Here's what I found. 

 

Setting up advanced conversions in Google Tag Manager for an embedded HubSpot form requires a slightly different approach: Custom Event Tracking. HubSpot forms typically trigger custom events when submitted. You can use these events to track form submissions in Google Tag Manager.

 

Create a Custom Event trigger:

  • Go to Triggers > New > Custom Event
  • Set the Event name to "hubspot-form-submit" (or the specific event name used by your HubSpot form

Create a Data Layer Variable for the email:

  • Go to Variables > New > Data Layer Variable
  • Set the Data Layer Variable Name to "hubspotEmail" (or the specific variable name used by HubSpot)

Create a Google Analytics 4 (GA4) tag for the conversion:

  • Go to Tags > New > Google Analytics: GA4 Event
  • Configure the tag with your GA4 Configuration
  • Set the Event Name (e.g., "form_submission")
  • Add a parameter for the email using your Data Layer Variable

Add custom JavaScript to your website to push the form data to the data layer:

window.addEventListener('message', function(event) {
  if (event.data.type === 'hsFormSubmit') {
    var email = event.data.data.email;
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'event': 'hubspot-form-submit',
      'hubspotEmail': email
    });
  }
});

This code listens for the HubSpot form submission event and pushes the email to the data layer.

 

Hopefully that helps a bit!

 

P.S. Here's one of the sources I found with more information.

 

Did my answer help? Please "mark as a solution" to help others find answers. Plus I really appreciate it!


Dan Moyle

HubSpot Advisor

LearningOps | Impulse Creative

emailAddress
dan@impulsecreative.com
website
https://impulsecreative.com/
0 Upvotes
PamCotton
Community Manager
Community Manager

tag manager advanced conversions

SOLVE

Hey @Salvoni, thank you for posting in our Community!

 

For advanced conversions with embedded HubSpot forms in Tag Manager, try using a click trigger on the submit button instead of a form submission trigger. Alternatively, add a Custom JavaScript trigger that listens for HubSpot form submissions. You can use the onFormSubmit callback to push events to the data layer, allowing GTM to capture the form interaction. Finally, verify the setup in GTM Preview mode and check conversions in Google Analytics or Google Ads.

 

@danmoyle and @Anton do you have any recommendations?

 

Thank you,

Pam

 

 

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


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




0 Upvotes