Streaming live at 10am (PST)

Send Google Analytics Client ID into hidden form field

Hello,

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.

52

What would you do instead?

Here is the read-only link: https://preview.webflow.com/preview/salesforce-berlitz-tests?utm_source=salesforce-berlitz-tests&preview=b3884063c6eafbe6e07e2ecc18512dcf

url: https://salesforce-berlitz-tests.webflow.io/

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):

<script>
  $(document).ready(function() {

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

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: