Documentation › Implementation › Migrating GTM to the new template

Migrating the old GTM implementation to the official template

The migration has three steps: copy the license key from the old tag, delete all the original Cookies správně tags and install the official template from the GTM gallery in their place.

Why migrate

The old implementation used several custom HTML tags. The official template replaces them with a single tag that is clearer, more secure and works correctly with Google Consent Mode: it sets the default consent state before the other tags and supports default consent by region. Old and new tags must not run side by side, as they would conflict.

1. Copy the license key

Do this before you delete anything. The license key is hidden inside the old bar tag, named Cookies správně – lišta.

  1. In GTM open the Cookies správně – lišta tag.
  2. In the tag content, find the <script> with the src attribute. It looks like this:
<script id="cookies-spravne"
  src="https://cookies-spravne.cz/static/cc?key=XXXXXXXXXXXXXXXXXXXX"
  async defer></script>

The license key is the string after key=. Save it; you will need it when configuring the new template. You can also find it in the dashboard on the license's Overview tab.

2. Remove the old tags

Once you have saved the key, delete these tags from the container (the names are as the old implementation created them):

  • Analytický tag – the analytics tag (Custom HTML)
  • Marketingový tag – the marketing tag (Custom HTML)
  • Consent mode (Consent Mode – Google + Microsoft tags)
  • Consent mode – update (Consent Mode – Google + Microsoft tags)
  • Cookies správně – lišta – the bar tag (Custom HTML)

None of them may remain active.

3. Install the official template

The procedure is the same as for a new installation; you will find all of it in the How to install the cookie bar through Google Tag Manager guide. In short:

  1. Add the Cookies správně template from the GTM template gallery to the container.
  2. When configuring it, enter the license key from the first step.
  3. Set it to fire with the Consent Initialization – All Pages trigger.
  4. In the license Configuration, choose Google Tag Manager as the Implementation type.
  5. Check the other tags: their Consent Settings and firing. Fire tags that require additional consent with the Custom Event trigger consentUpdate. If you have tags set to gtm_consent_update together with All Pages, switch them to consentUpdate.
  6. Test in the preview and publish.

Before you publish the changes, go through the preview in Tag Assistant. Before consent, tags that require consent must be Not Fired, and after consent is given the consentUpdate event must appear. Then open the website once more without deleting cookies: the bar no longer appears, yet the tags must still fire.