Streaming live at 10am (PST)

Send variable (google cliendId) from Tag Manager to a hidden field

Hi there, I’m trying to get Google Tag Manager to send a variable (Google clientId) to a hidden field in a form. Google Tag Manager is able to identify the cliendId.

Currently I’m using the following HTML code for the hidden field

< input type=“hidden” id=“hidId” name=“hidId” value="" >

In Google Tag Manager I’m doing the following:

I’ve created a custom HTML tag:

< script type=“application/javascript”>
var hidId = document.getElementById("#hidId");
hidId.value={{GA - Client ID}};
< /script>

I also tried:

< script type=“application/javascript”>
var hidId = document.querySelector("#hidId");
hidId.value={{JS - GA Client ID}};
< /script>

I set up a delay of 5 seconds to make sure tag manager first recognizes the clientId, which it does when firing the tag.

Can anyone help me get the Google clientId in a hidden form field?

Here is my site Read-Only: Webflow - Solar Sedum

Also tried this code in Tag Manager

< script>
var clientId = {{GA - Client ID}};
var clientIdFields = document.querySelectorAll({{Client Id Field CSS Selector}});
for (i = 0; i < clientIdFields.length; i++){
var clientIdField = clientIdFields[i];
cientIdField.value = clientId;
< /script>