Skip to main content
All CollectionsData ConnectorsOther solutions
Tracking Hubspot events with Google Analytics
Tracking Hubspot events with Google Analytics
Ilona Norman avatar
Written by Ilona Norman
Updated over a week ago

If you are using Hubspot you may have interesting lead or customer events there that you would like to track and be able to attribute back to a paid advertising campaign. 

This article will explain how you can set up a tracking solution for you Hubspot events to view them as goals in Google Analytics, and from there view them in Funnel along with their related advertising cost.

Hubspot setup

To link the events from your website, through Hubspot to GA you need to capture the GA client id. This is the identifier Google Analytics uses to keep track of a specific browser, and the id is stored in the Google Analytics cookie. To make sure you have the GA client id available in Hubspot you will have to modify all your Hubspot forms to capture this.

In Hubspot create contact property "GA Client id" with the internal name "ga_client_id"

In all Hubspot forms add "GA Client id" as an optional hidden field
Modify the script tag on all Hubspot forms to set ga_client_id if the GA cookie is set

<script charset="utf-8" type="text/javascript" src="//"></script>
 function setGaClientId() {
 if ($('[name=ga_client_id]')[0]) {
     $('[name=ga_client_id]').val(_((Cookies.get('_ga') || '').split('.')).takeRight(2).join('.'));
 css: '',
 portalId: '',
 formId: '',
 onFormSubmit: setGaClientId

Send events from Hubspot to GA using Zapier

Go to Zapier, sign up if you're new to their service, and start by hitting the "Make a ZAP!" button.
Choose "Hubspot" (not "Hubspot CRM") as the trigger and follow the instructions to connect to your Hubspot account. Use "New Contact Property Change" to create events based on Hubspot properties.

For the Zap action choose "Webhooks by Zapier" and use the option "GET request". At this point you will have to configure the parameters that Zapier will send to Google Analytics

To make sure Zapier will only send events on the correct property changes, hit the small + icon between the "Trigger" and "Action" on the left side of the screen to add a "Filter".

Google Analytics setup

In Google Analytics create a goal from your event. Use "Event" as the goal type, and make sure to match the category and action from your Zapier action.


At this point the whole event chain should be set up. Make sure the data looks correct in your Google Analytics and finally go to Funnel and locate your new data in the metrics under "Google Analytics conversion metrics > Goals > Completions"

Finally, enjoy viewing the goal data in Funnel

Did this answer your question?