Google Analytics Conversion Event from Form Submission

Written by Brandon Jarousky | Mar 12, 2019 9:26:02 PM

Implementation for Embedded HubSpot Forms:

Within the form embed code, include an onFormSubmit attribute which will be used to trigger the event script.

Example code:

You will swap out the sample data included within the above script. This includes:

 

'CustomFormSubmission' -> name of your event

''send_to': 'UA-116382420-1' -> your Google Analytics UA code
'event_category': 'Test' -> your event category
'event_action': 'Submit' -> your event action
'event_label': 'Form' - your event label
'value': 10 -> your event value

 

Implementation for HubSpot Forms used in a Form Module:

Before the closing body tag of the page, or in a Javascript file, include the following code:

You will swap out the sample data included within the above script. This includes:

 

'CustomFormSubmission' -> name of your event

''send_to': 'UA-116382420-1' -> your Google Analytics UA code
'event_category': 'Test' -> your event category
'event_action': 'Submit' -> your event action
'event_label': 'Form' - your event label
'value': 10 -> your event value