APIs & Integrations

accortdr
Participant

Get Google Analytics Client ID into Hubspot for ALL page views (Not just form submissions)

There are a lot of posts around getting the client id from google analytics by adding some javascript to your GTM and having it store the data in a hidden property on your form.

var clientId = ga.getAll()[0].get('clientId'); $( document ).ready(function() { $('form input#ga_client_id').val(clientId); });

 

My issue is that we want to be able to track this information on all page views not just when a form is submitted. Is there a way that we can get the javascript to fire and to have Hubspot store this data with the user's HubID or some other user based attribute? 

 

 

0 Votes
4 Réponses
ralphioooo
Contributeur | Partenaire solutions Diamond
Contributeur | Partenaire solutions Diamond

Get Google Analytics Client ID into Hubspot for ALL page views (Not just form submissions)

We have just created a HubSpot APP called Analytics Amplifier that helps you do this + push offline events to Google Analytics when they happen.

 

Check it out here:
https://ecosystem.hubspot.com/marketplace/apps/marketing/analytics-data/google-analytics-amplifier-2...

0 Votes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Get Google Analytics Client ID into Hubspot for ALL page views (Not just form submissions)

Hi, @accortdr.

 

If you have the visitor's email, you can pass values to custom contact properties with the tracking code's identify function.

Isaac Takushi

Associate Certification Manager
0 Votes
accortdr
Participant

Get Google Analytics Client ID into Hubspot for ALL page views (Not just form submissions)

How would we do that? Would we fire the js on every page view? We'd have to validate the users id in Hubspot first before we could trigger the GA client id right?

0 Votes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Get Google Analytics Client ID into Hubspot for ALL page views (Not just form submissions)

Hi, @accortdr.

 

Apologies for the delayed response; I have been out of the office.

 

Yes, you could fire the identify function on every qualifying page view. For example, you could use custom JavaScript to only trigger the function if a gclid parameter is in the URL.

 

Per your second question, which user ID would you be validating? The "external ID" mentioned in this documentation? If so, that doesn't require validation in HubSpot so long as you either also have the user's email or the ID has already been associated with an email from a previous identify event.

 

Thus, you could push the gclid value into HubSpot at the same time you are pushing it into the data layer.

 

This similar Community thread discusses both the identify and dataLayer.push events.

Isaac Takushi

Associate Certification Manager
0 Votes