# Trigger Google Analytics Event with Form Submission

**URL:** <https://community.hubspot.com/t/trigger-google-analytics-event-with-form-submission/11370>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [September 7, 2017, 1:12pm UTC](https://community.hubspot.com/t/trigger-google-analytics-event-with-form-submission/11370 "2017-09-07T13:12:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [February 12, 2018, 12:49pm UTC](https://community.hubspot.com/t/trigger-google-analytics-event-with-form-submission/11370/4 "2018-02-12T12:49:47Z")

</div>

Where you paste that code?  
“Here is the code I used:  
hbspt.forms.create({  
css: ‘’,  
portalId: ‘XXXXXXX’,  
formId: ‘XXXXXXX-XXX-XXX-XXXXXXX’,  
onFormSubmit: function($form) {  
”\_gaq.push([’\_trackEvent’, ‘Contact’, ‘contact\_us\_form’, ‘Main\_Contact\_Us’, false]);"  
},  
submitButtonClass: ‘btn btn-primary btn-hubspot’,  
locale: ‘en’,  
translations: {  
en: {phoneInvalidLengthOrFormat: ‘Please enter a valid phone number.’}  
}  
});"

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’);”

Thanks for your time.

---

_[View the full topic](https://community.hubspot.com/t/trigger-google-analytics-event-with-form-submission/11370)._
