<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Trigger Google Analytics Event with Form Submission in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223490#M2386</link>
    <description>&lt;P&gt;I read this article, which shows you how to add Google Analytics event tracking to a HubSpot form submission:&lt;/P&gt;
&lt;ASIDE class="onebox whitelistedgeneric"&gt;
  &lt;HEADER class="source"&gt;
      &lt;IMG src="https://developers.hubspot.com/hs-fs/hub/428357/file-2168997910-ico/favicon.ico?t=1511211924848" class="site-icon" width="16" height="16" /&gt;
      &lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="nofollow noopener"&gt;developers.hubspot.com&lt;/A&gt;
  &lt;/HEADER&gt;
  &lt;ARTICLE class="onebox-body"&gt;
    

&lt;H3&gt;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="nofollow noopener"&gt;How to customize the form embed code&lt;/A&gt;&lt;/H3&gt;

&lt;P&gt;This is a list of options that you can use if you just need to tweak a default hubspot form. If you need complete control over the styles and actions of your form, you will still want to use the Forms API.&lt;/P&gt;


  &lt;/ARTICLE&gt;
  &lt;DIV class="onebox-metadata"&gt;
    
    
  &lt;/DIV&gt;
  &lt;DIV style="clear: both"&gt;&lt;/DIV&gt;
&lt;/ASIDE&gt;

&lt;P&gt;I applied this to one of my embedded HubSpot forms, but it doesn’t seem to be tracking the event in Google Analytics. I am not using Google Tag Manager.&lt;/P&gt;
&lt;P&gt;Here is the code I used:&lt;BR /&gt;
hbspt.forms.create({&lt;BR /&gt;
css: ‘’,&lt;BR /&gt;
portalId: ‘XXXXXXX’,&lt;BR /&gt;
formId: ‘XXXXXXX-XXX-XXX-XXXXXXX’,&lt;BR /&gt;
onFormSubmit: function($form) {&lt;BR /&gt;
"_gaq.push([’_trackEvent’, ‘Contact’, ‘contact_us_form’, ‘Main_Contact_Us’, false]);"&lt;BR /&gt;
},&lt;BR /&gt;
submitButtonClass: ‘btn btn-primary btn-hubspot’,&lt;BR /&gt;
locale: ‘en’,&lt;BR /&gt;
translations: {&lt;BR /&gt;
en: {phoneInvalidLengthOrFormat: ‘Please enter a valid phone number.’}&lt;BR /&gt;
}&lt;BR /&gt;
});&lt;/P&gt;
&lt;P&gt;I realize that this is very similar to the question posed in this forum, but I followed these instructions and am still running into issues.&lt;BR /&gt;
&lt;ASIDE class="quote group-HubSpotters" data-post="2" data-topic="2265"&gt;
&lt;/ASIDE&gt;&lt;/P&gt;&lt;DIV class="title"&gt;
&lt;DIV class="quote-controls"&gt;&lt;/DIV&gt;
&lt;IMG alt="" width="20" height="20" src="https://discourse-cdn-sjc1.com/hubspot/user_avatar/integrate.hubspot.com/pmanca/40/285_1.png" class="avatar" /&gt;&lt;A href="https://integrate.hubspot.com/t/triggering-a-google-analytics-event/2265/2" rel="nofollow noopener"&gt;Triggering a Google Analytics event&lt;/A&gt;
&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A class="mention" href="https://community.hubspot.com/users/champion"&gt;@Champion&lt;/A&gt; You could add the onFormSubmit function to the embed code which could then call your google analytics event.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Any help/guidance you could provide would be helpful.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2017 13:12:17 GMT</pubDate>
    <dc:creator>amybeans</dc:creator>
    <dc:date>2017-09-07T13:12:17Z</dc:date>
    <item>
      <title>Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223490#M2386</link>
      <description>&lt;P&gt;I read this article, which shows you how to add Google Analytics event tracking to a HubSpot form submission:&lt;/P&gt;
&lt;ASIDE class="onebox whitelistedgeneric"&gt;
  &lt;HEADER class="source"&gt;
      &lt;IMG src="https://developers.hubspot.com/hs-fs/hub/428357/file-2168997910-ico/favicon.ico?t=1511211924848" class="site-icon" width="16" height="16" /&gt;
      &lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="nofollow noopener"&gt;developers.hubspot.com&lt;/A&gt;
  &lt;/HEADER&gt;
  &lt;ARTICLE class="onebox-body"&gt;
    

&lt;H3&gt;&lt;A href="https://developers.hubspot.com/docs/methods/forms/advanced_form_options" target="_blank" rel="nofollow noopener"&gt;How to customize the form embed code&lt;/A&gt;&lt;/H3&gt;

&lt;P&gt;This is a list of options that you can use if you just need to tweak a default hubspot form. If you need complete control over the styles and actions of your form, you will still want to use the Forms API.&lt;/P&gt;


  &lt;/ARTICLE&gt;
  &lt;DIV class="onebox-metadata"&gt;
    
    
  &lt;/DIV&gt;
  &lt;DIV style="clear: both"&gt;&lt;/DIV&gt;
&lt;/ASIDE&gt;

&lt;P&gt;I applied this to one of my embedded HubSpot forms, but it doesn’t seem to be tracking the event in Google Analytics. I am not using Google Tag Manager.&lt;/P&gt;
&lt;P&gt;Here is the code I used:&lt;BR /&gt;
hbspt.forms.create({&lt;BR /&gt;
css: ‘’,&lt;BR /&gt;
portalId: ‘XXXXXXX’,&lt;BR /&gt;
formId: ‘XXXXXXX-XXX-XXX-XXXXXXX’,&lt;BR /&gt;
onFormSubmit: function($form) {&lt;BR /&gt;
"_gaq.push([’_trackEvent’, ‘Contact’, ‘contact_us_form’, ‘Main_Contact_Us’, false]);"&lt;BR /&gt;
},&lt;BR /&gt;
submitButtonClass: ‘btn btn-primary btn-hubspot’,&lt;BR /&gt;
locale: ‘en’,&lt;BR /&gt;
translations: {&lt;BR /&gt;
en: {phoneInvalidLengthOrFormat: ‘Please enter a valid phone number.’}&lt;BR /&gt;
}&lt;BR /&gt;
});&lt;/P&gt;
&lt;P&gt;I realize that this is very similar to the question posed in this forum, but I followed these instructions and am still running into issues.&lt;BR /&gt;
&lt;ASIDE class="quote group-HubSpotters" data-post="2" data-topic="2265"&gt;
&lt;/ASIDE&gt;&lt;/P&gt;&lt;DIV class="title"&gt;
&lt;DIV class="quote-controls"&gt;&lt;/DIV&gt;
&lt;IMG alt="" width="20" height="20" src="https://discourse-cdn-sjc1.com/hubspot/user_avatar/integrate.hubspot.com/pmanca/40/285_1.png" class="avatar" /&gt;&lt;A href="https://integrate.hubspot.com/t/triggering-a-google-analytics-event/2265/2" rel="nofollow noopener"&gt;Triggering a Google Analytics event&lt;/A&gt;
&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A class="mention" href="https://community.hubspot.com/users/champion"&gt;@Champion&lt;/A&gt; You could add the onFormSubmit function to the embed code which could then call your google analytics event.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Any help/guidance you could provide would be helpful.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 13:12:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223490#M2386</guid>
      <dc:creator>amybeans</dc:creator>
      <dc:date>2017-09-07T13:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223491#M2387</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/amybenes"&gt;@amybenes&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Based on some documentation I’ve read (&lt;A href="https://developers.google.com/analytics/devguides/collection/analyticsjs/events"&gt;here&lt;/A&gt;), it looks like you might want to consider using something like this:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;ga(‘send’, ‘event’, ‘Videos’, ‘play’, ‘Fall Campaign’);&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Regardless, you should remove the quotes surrounding the Google Analytics event inside the &lt;CODE&gt;onFormSubmit&lt;/CODE&gt; function, as this worked in my own testing.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 21:31:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223491#M2387</guid>
      <dc:creator>Derek_Gervais</dc:creator>
      <dc:date>2017-09-07T21:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223492#M2388</link>
      <description>&lt;P&gt;Hi – this worked. thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 21:55:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223492#M2388</guid>
      <dc:creator>amybeans</dc:creator>
      <dc:date>2017-09-14T21:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223493#M2389</link>
      <description>&lt;P&gt;Where you paste that code?&lt;BR /&gt;
“Here is the code I used:&lt;BR /&gt;
hbspt.forms.create({&lt;BR /&gt;
css: ‘’,&lt;BR /&gt;
portalId: ‘XXXXXXX’,&lt;BR /&gt;
formId: ‘XXXXXXX-XXX-XXX-XXXXXXX’,&lt;BR /&gt;
onFormSubmit: function($form) {&lt;BR /&gt;
”_gaq.push([’_trackEvent’, ‘Contact’, ‘contact_us_form’, ‘Main_Contact_Us’, false]);"&lt;BR /&gt;
},&lt;BR /&gt;
submitButtonClass: ‘btn btn-primary btn-hubspot’,&lt;BR /&gt;
locale: ‘en’,&lt;BR /&gt;
translations: {&lt;BR /&gt;
en: {phoneInvalidLengthOrFormat: ‘Please enter a valid phone number.’}&lt;BR /&gt;
}&lt;BR /&gt;
});"&lt;/P&gt;
&lt;P&gt;I have an hubspot form and i want to do that on click button, but i don’t know where is the place to paste this code p.e. “ga(‘send’, ‘event’, ‘Videos’, ‘play’, ‘Fall Campaign’);”&lt;/P&gt;
&lt;P&gt;Thanks for your time.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 12:49:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223493#M2389</guid>
      <dc:creator />
      <dc:date>2018-02-12T12:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223494#M2390</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/daniel_marques"&gt;@Daniel_Marques&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;You’ll want to put that inside the &lt;CODE&gt;onFormSubmit&lt;/CODE&gt; callback, where the &lt;CODE&gt;_gaq.push&lt;/CODE&gt; call is now. You’ll probably also want to check out the &lt;CODE&gt;ga.js&lt;/CODE&gt; to &lt;CODE&gt;analytics.js&lt;/CODE&gt; migration docs, if you haven’t already:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#events" class="onebox" target="_blank"&gt;https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs#events&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:33:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223494#M2390</guid>
      <dc:creator>Derek_Gervais</dc:creator>
      <dc:date>2018-02-13T19:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223495#M2391</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/derek_gervais"&gt;@Derek_Gervais&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Could I use this to add an ga event after submission of a regular HubSpot form (not embedded) ?&lt;/P&gt;
&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 17:37:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223495#M2391</guid>
      <dc:creator />
      <dc:date>2018-02-28T17:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223496#M2392</link>
      <description>&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/laurent_maillard"&gt;@Laurent_Maillard&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;There isn't currently a way to access the &lt;CODE&gt;onFormSubmit&lt;/CODE&gt; callback globally or via the UI, so you'd need to either replace it with an embedded form or use a workaround like detecting the &lt;CODE&gt;hsvalidatedsubmit&lt;/CODE&gt; event (see below).&lt;/P&gt;
&lt;ASIDE class="quote group-HubSpotters" data-post="2" data-topic="2805"&gt;
&lt;DIV class="title"&gt;
&lt;DIV class="quote-controls"&gt;&lt;/DIV&gt;
&lt;IMG alt="" width="20" height="20" src="https://discourse-cdn-sjc1.com/hubspot/user_avatar/integrate.hubspot.com/dadams/40/26_1.png" class="avatar" /&gt; dadams:&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Hi &lt;A class="mention" href="https://community.hubspot.com/u/arlo_gilbert"&gt;@Arlo_Gilbert&lt;/A&gt;  The hsvalidatedsubmit event is triggered after the data in a HubSpot form passes validation.  You can detect when that event is triggered, but anything you do after detecting the event would not block the submission from proceeding.  The onFormSubmit function gets executed as part of the submission itself, so anything you include in that function will be executed before the form proceeds with the submission.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/ASIDE&gt;</description>
      <pubDate>Fri, 02 Mar 2018 19:53:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/223496#M2392</guid>
      <dc:creator>Derek_Gervais</dc:creator>
      <dc:date>2018-03-02T19:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/257876#M22967</link>
      <description>&lt;P&gt;Hi, I'm trying to trigger GA events from an embedded hubspot form as well, but it's not working after following the instructions. Here is my form code - what have I done incorrectly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;lt;!--[if lte IE 8]&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;![endif]--&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;script&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; hbspt.forms.create({&lt;/DIV&gt;&lt;DIV&gt;portalId: "4326424",&lt;/DIV&gt;&lt;DIV&gt;formId: "106e45cd-6e1d-43b2-af21-78798a4b3e68",&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; onFormSubmit: function($form){&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ga ('send', 'event', 'form-submit', 'contact-submit', 'contact-us-page')&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; },&lt;/DIV&gt;&lt;DIV&gt;});&lt;/DIV&gt;&lt;DIV&gt;&amp;lt;/script&amp;gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Mar 2019 00:42:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/257876#M22967</guid>
      <dc:creator>scottfasser</dc:creator>
      <dc:date>2019-03-08T00:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/292386#M27217</link>
      <description>&lt;P&gt;Hi all - battling with this same issue. I really think that the better route to follow is to first implement Google Tag Manager and then republish you GA script but through GTM..&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;"Google Tag Manager is a tag management system that allows you to create and monitor tags on a user interface, without writing new code each time you want to construct a tag. You simply embed the Google Tag Manager code into each page of your website. This eliminates the manual process of creating tags, making your marketing process more efficient and precise."&lt;/EM&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Once done - you will be in a much better position to track conversions in Hubspot. With GTM installed here is how you can track HS forms in GTM and GA:&lt;/P&gt;&lt;P&gt;&lt;A href="https://analytive.com/blog/the-super-easy-way-to-track-hubspot-forms-in-google-tag-manager-and-analytics/" target="_blank"&gt;https://analytive.com/blog/the-super-easy-way-to-track-hubspot-forms-in-google-tag-manager-and-analytics/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 10:43:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/292386#M27217</guid>
      <dc:creator>jonnoprice1</dc:creator>
      <dc:date>2019-09-20T10:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/338952#M33068</link>
      <description>&lt;P&gt;I have followed this GTM instrucion as followed but the tag is not firing. In the trigger, I used the option to record every embedded form completion. So I used the "&lt;SPAN&gt;hbspt-form" option in the trigger which is found from the page where the form is embedded.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-05-14 at 10.44.35.png" style="width: 514px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/26852i3945D23936641335/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-14 at 10.44.35.png" alt="Screenshot 2020-05-14 at 10.44.35.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there something that I'm missing here?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 07:47:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/338952#M33068</guid>
      <dc:creator>juhafly</dc:creator>
      <dc:date>2020-05-14T07:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/354115#M34768</link>
      <description>&lt;P&gt;link broken&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 07:14:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/354115#M34768</guid>
      <dc:creator>Jordanwywm</dc:creator>
      <dc:date>2020-07-14T07:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/424978#M42215</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a similar problem since we should embed a Google Analytics event tracking code in HubSpot form. Conversion is when a customer clicks a send button of the contact form. My question is that where is the right place for GA Event tracking code? And is this type of code the best option in this case:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="pln"&gt;ga&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str"&gt;'send'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;'event'&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;A href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventCategory" target="_blank"&gt;&lt;SPAN class="pln"&gt;eventCategory&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;A href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventAction" target="_blank"&gt;&lt;SPAN class="pln"&gt;eventAction&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;A href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventLabel" target="_blank"&gt;&lt;SPAN class="pln"&gt;eventLabel&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;A href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue" target="_blank"&gt;&lt;SPAN class="pln"&gt;eventValue&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fieldsObject&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the above code and replaced Category, Action and Label fields by our campaign names from Google Analytics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code of the HubSpot form:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!--[if lte IE 8]&amp;gt;&lt;BR /&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;![endif]--&amp;gt;&lt;BR /&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;hbspt.forms.create({&lt;BR /&gt;region: "na1",&lt;BR /&gt;portalId: "4128102",&lt;BR /&gt;formId: "3a46f667-8e71-464a-8b45-d0956e30b917"&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 06:44:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/424978#M42215</guid>
      <dc:creator>JHakkarainen</dc:creator>
      <dc:date>2021-04-06T06:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/459454#M45063</link>
      <description>&lt;P&gt;Hi Derek, I'm trying to replicate this in my form with no sucess... could you please add the onFormSubmit function to the below code? everytime I add it the form doesnt display.... thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;!--[if lte IE 8]&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;![endif]--&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;hbspt.forms.create({&lt;/P&gt;&lt;P class="p1"&gt;region: "na1",&lt;/P&gt;&lt;P class="p1"&gt;portalId: “xxxx”,&lt;/P&gt;&lt;P class="p1"&gt;formId: “xxxxx”,&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;});&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 23:37:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/459454#M45063</guid>
      <dc:creator>Nigrinis</dc:creator>
      <dc:date>2021-07-14T23:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Google Analytics Event with Form Submission</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/459457#M45064</link>
      <description>&lt;P&gt;Hi Can you share your final code working? I can't get to work mine.... it is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;!--[if lte IE 8]&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;![endif]--&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;hbspt.forms.create({&lt;/P&gt;&lt;P class="p1"&gt;region: "na1",&lt;/P&gt;&lt;P class="p1"&gt;portalId: “xxx”,&lt;/P&gt;&lt;P class="p1"&gt;formId: "dxxxf”,&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;onFormSubmit: function($form){&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; ga ('send', 'event', 'form-submit', 'contact-submit', 'contact-us-page')&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; },&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;});&lt;/P&gt;&lt;P class="p1"&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 23:44:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trigger-Google-Analytics-Event-with-Form-Submission/m-p/459457#M45064</guid>
      <dc:creator>Nigrinis</dc:creator>
      <dc:date>2021-07-14T23:44:31Z</dc:date>
    </item>
  </channel>
</rss>

