Streaming live at 10am (PST)

Send Google Analytics Client ID into hidden form field


I’m trying to figure out how to send in a hidden form field, the Google Analytics Client ID. I’m using this code, but it does not work as expected.


What would you do instead?

Here is the read-only link:


What if you remove “form#Form” from the script?

So this “#Google_Analytics_Client_ID__c” instead of “form#Form #Google_Analytics_Client_ID__c

Hi @philipboomy ,

Thanks for the suggestion. Unfortunately, it still does not work for me. Not sure where the problem is.

Hey I’m trying to get the same thing to work. Did you find a solution?

Hi @Ruben_Van_Den_Oever ,

Yes, we ended up using the following script (Project settings custom code, before your body tag):

  $(document).ready(function() {

	function waitforeverything() {
      // GAUID
      var gauid = ga.getAll()[0].get('clientId');
      $('input#Google_Analytics_Client_ID__c').attr('value', gauid);
    setTimeout(waitforeverything, 3000)

And in your form, you add an HTML embed element where you include your hidden input:

<input type="hidden" name="Google_Analytics_Client_ID__c" id="Google_Analytics_Client_ID__c" value="" />

@Berlitz Thank you for your quick response!

Implemented it, but seems to not see my client ID. Perhaps mine is because it is blocked from analytics. Just going to wait for a response and hope it will work :slight_smile: