Capture Client ID in hidden field from Tag Manager


#1

I’m trying to populate a hidden form field ‘client_id’, made available using Google Tag Manager. So, on Window Loaded I have this variable: 1st Party Cookie string ‘GA1.2.703537689.1505909694’.

How do I grab this bit “703537689.1505909694” and automatically populate a hidden field in a form with id ‘client_id’.

The reason I am doing this is because I need to tie offline conversions (all our sales happen offline) to online lead generation. Once we have a client_ID tied to a customer in our system, we are able to accurately calculate ROI.

Answer:


#2

#3

Hi Edward,

What’s the full URL look like with the variable in it? Usually, if you just create a hidden field with the exact name of the URL parameter, it’ll pull it in automatically.

See here: https://documentation.unbounce.com/hc/en-us/articles/203799174-Adding-and-Editing-Form-Fields#content4


#4

Hello- I am having the same issue and need to obtain the Google Analytics Client ID (see the instruction in Google’s guide https://support.google.com/analytics/answer/7584446 step 3)

To Nicholas question- This is not a value that is stored in the URL, but in the Google Analytics Cookie. I tried using the Java Script editor but I believe there are issues as Unbounce defaults the GTM placement after the body, thus the new scripts load before the GA cookie is loaded within GTM. Would really like some help on this!


#5

Hi @jon.gardiner,

If you have an Unbounce form, you can always pause the form submit event. Fill in your hidden field and release the form.

By the time the form is filled out, all of the cookies would have been loaded.

Best,
Hristian