APIs & Integrations

Girl_tries_code
Member

Tracking Form Submission

Hi, I have read the few requests here but couldn't find a solution.

What I want to be doing is for my GA/Ads to track a Hubspot form submission (on a Hubspot website) as an event. 

 

I was passed this by my team to insert in the header - but I do not know what "event" to put in.

 

<!-- Event snippet - Sign Up Completed conversion page
In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->

<script>
function gtag_report_conversion(url) {
  var callback = function () {
    if (typeof(url) != 'undefined') {
      window.location = url;
    }
  };
  gtag('event', 'conversion', {
      'send_to': 'XXXXXXXXXXXXXXXXXXX',
      'event_callback': callback
  });
  return false;
}
</script>
0 Upvotes
1 Reply 1
WendyGoh
HubSpot Employee
HubSpot Employee

Tracking Form Submission

Hi @Girl_tries_code,

 

I hope all is well with you 😃

 

When looking to track HubSpot form submission in GA, you may want to explore the option of modifying the embed code of your form and insert the GA tracking code into the onFormSubmitevent.

 

Additionally, I'd love to share with you these useful resources which includes examples:

Hope this helps to clarify!

0 Upvotes