Skip to content
Working hours Telegram @kalaganov5

Updating a variable in dataLayer Google Tag Manager

If need updating a variable in dataLayer use code:

<script>
  window.google_tag_manager["GTM-XXXXXXX"].dataLayer.set("variable", "value");
</script>

Where “GTM-XXXXXXX” – container id or use “{{Container ID}}” (automatically set our container id), “variable” – variable for updating, “value” – new value. Example work code:

<script>
  window.google_tag_manager[{{Container ID}}].dataLayer.set("userName", "Admin");
</script>

Describe your task

The first estimate is free. From your description and a link to the site I’ll give you a rough price and timeline. If paid diagnostics are needed, we agree on them before I start. I reply within one working hour, Mon–Fri 10:00–19:00 Tbilisi time (09:00–18:00 Moscow).

Faster on Telegram

    How enquiry data is handled is described in the privacy policy. An NDA can be agreed before you share materials.