Is the google anaytics Client ID in hubspot somewhere?
Hello. Hi. Our Google Tag Manager tag injects GA CID form field into Non Hubspot Forms, that can be still tracked by HubSpot. If you're about to track offline conversions in GA, the CID field is by far not a single one you need to track to bypass GA filter as well as to send a proper GEO of a user, not a server.
Is the google anaytics Client ID in hubspot somewhere?
jgardner,
It works with the tag manager. The solution below will work if you have a "Google Universal Analytics Standard Pageview Tag" setup already and a field called "google_client_id" in your form.
In tag manager create a "Custom HTML Tag" and put the code below in it. Have it trigger on "All Pages" "Pageview" then it will trigger on all your pages, a little messy bit it will work for sure, or you can create a trigger with exceptions for just the pages with the forms.
3% of the time the value won't make it into the field because the field isn't there yet when the tag fires, I'm working on solution for that hopefully.
<script>
$(window).on('load', function (){
var clientId = ga.getAll()[0].get('clientId');
$('input[name="google_client_id"]').val(clientId).change();
});
</script>
Is the google anaytics Client ID in hubspot somewhere?
Hi cre,
Yes this works, about 3% of the time the clientID won't make it into the field, my only explanation is some kind of browser plugin/privacy blocker/java script turned off on the user side. I've tested just putting hard coded text into the hidden field with java script and j query with the same result, even with a delay in seconds. So if 97% is good enough, it works
Is the google anaytics Client ID in hubspot somewhere?
Hi there,
Is this script still working for anyone? I implemented in Google Tag Manager, however it won't work for me. I added the tag and a trigger for "all pages", as well as the hidden field in the form.
Does anyone have any hints on how to get this working? Much appreciated!
Is the google anaytics Client ID in hubspot somewhere?
We are trying to impliment this within Google Tag Manager....is that possible? If so, what would triggering look like? Would we have it fire on all pages containing forms or with the "form submit" trigger? Thanks!
Is the google anaytics Client ID in hubspot somewhere?
Thanks for the help Mezar!
This code below works for me.
Of course your page where this script lives would have to have a field called 'google_client_id'. Or you can put it in the tag manager as 'Custom HTML'.
A caveat about 3% of the time the clientid isn't captured in the hidden field, anybody have any ideas?
The (window).load is there to wait for the content to load before it tries to populate the hidden field.
Is the google anaytics Client ID in hubspot somewhere?
Hey there Steve! You could have just emailed me, haha.
Nope.
Create the form field, then put the following script in the section, AFTER the Google Tag Manager and Facebook tracking codes, and BEFORE the closing tag (obviously changing the form field id in the code below):
You gotta put it in the right place though, because if this Javascript runs before the analytics.js library has loaded, then the tracker object may not exist yet.
Is the google anaytics Client ID in hubspot somewhere?
I am curious if anyone got this to work?
I tried placing the code above and a few variations in the footer and then in a module on the page with no success. Google tag manager is in the page head.