You can find dozens of tags in the container. Some fire twice, others are no longer used by anyone, and a variable called "test2-final" decides reported revenue. As long as nothing changes, the website measures. At the first change, however, nobody wants to sign off on publication.
The original version of this article contained 19 specific settings for the Google Analytics, AdWords, Sklik, Facebook, and now-defunct tools of the time. It was practical in its day. Today, copying old tags would create technical debt. More important is a system that survives a new interface and a platform replacement.
GTM does not create data; it only controls its path
Google Tag Manager works with three basic elements:
- A tag sends or processes data for a specific service.
- A trigger determines on which event and under which conditions a tag activates.
- A variable supplies a value, for example a transaction ID, price, or page type.
GTM itself does not know that an order has been paid. The website or backend must provide that information. If the source signal is wrong, a perfectly configured tag only sends the error more quickly to more systems.
The data layer is an agreement between the website and marketing
The data layer is a structured layer through which the website passes events and values to tags. Instead of reading the price from a particular HTML element, the application sends an event with stable fields when a purchase is completed.
window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: 'purchase', ecommerce: { transaction_id: 'OBJ-12345', value: 2490, currency: 'CZK', items: [] } });This is a simplified example of the principle, not a complete e-commerce implementation. Align the specific structure with the current recommendation of the target platform. What matters is that names, types, and the timing of the event are agreed and testable.
I would not rely on the URL of a thank-you page or the text of a button if the website can provide an actual business event. Text and URLs change during redesign. The data-layer agreement should remain stable.
First the measurement plan, then the container
For every business step, write down:
- the event name,
- the exact condition under which it occurs,
- mandatory parameters and their format,
- the source of truth,
- the systems to which it may be sent,
- the required consent state,
- the owner and test method.
For an enquiry, distinguish a submitted form from a qualified lead. For an online store, distinguish an order start from a confirmed purchase. This prevents the advertising algorithm from optimising for an easy but commercially weak action.
Names must survive several tools
Use consistent lowercase event names and clearly described parameters. Where GA4 offers a recommended event, such as generate_lead, add_to_cart, or purchase, it makes sense to follow the official name and parameters. You gain more compatible reports and less need for translation layers.
Other platforms may require their own name. Do the translation only in the tag. The website should send one comprehensible business event, not five almost identical signals according to the supplier's logo.
Consent must be part of the architecture
A cookie banner and GTM must not work as two separate worlds. The default consent state must be available before tags, and it must update correctly after the user's choice. Google describes Consent Mode for its tags, including basic and advanced modes.
Consent Mode is not a banner or legal assessment. The company must obtain consent where required, pass its state, and ensure that all tags — including those outside Google — respect the choice. Custom HTML is not a suitable shortcut for managing consent for Google tags; use supported mechanisms and templates.
Prefer a native template to a random script
For Google tag, Google Ads, and other supported services, use a native or trusted approved template. Reserve Custom HTML for a situation that cannot be safely resolved otherwise. Every third-party script adds performance, security, and maintenance risk.
Once every quarter, review the container and remove tags for services the company no longer uses. An inactive marketing tool should not have access to visitors merely because it was forgotten.
Testing must verify data, order, and the failure to fire
Preview and Tag Assistant show which tags fired, in which order, and with which data. Seeing the Fired status is not enough. I also check:
- whether the tag fired exactly once,
- whether it did not fire at the wrong step,
- the value, currency, transaction ID, and items,
- the network request and response of the target service,
- the state in the platform's real-time or test mode,
- both granted and denied consent,
- mobile, redirects, failed payment, and repeated loading.
For a purchase, I compare the result with the backend. When GTM reports one transaction and the ordering system another, Tag Assistant does not determine accounting reality.
Publication needs a version and a route back
Before a change, use a separate workspace if several people work on the container. Name a publication by its outcome, not "version 37," and describe the events changed. Google Tag Manager saves a container version on publication, so history can be traced and the previous state restored if an error occurs.
Rollback does not replace testing, however. If the website and data layer changed at the same time, the old container may not work with the current code. Deploy website and measurement versions in coordination.
Twelve points for a healthy container
- There is one correct container on the website, and its placement follows the installation instructions.
- A measurement plan and an owner exist for every key event.
- The website sends a stable data layer instead of fragile page reading.
- Names and parameters are consistent and documented.
- Personal data is not sent to the data layer without a lawful, approved reason.
- Consent is configured before relevant tags fire.
- Google and advertising tags use supported templates where they exist.
- Every tag has a limited, comprehensible trigger.
- A purchase and lead cannot accidentally be sent twice.
- Testing also covered negative scenarios and denied consent.
- The publication has a name, description, and a known route back.
- Unused tags, variables, and access are removed regularly.
Where GA4, Meta, and advertising systems fit
GTM is a traffic junction. Google Analytics 4 deals with the meaning of events and reports. The article on Conversions API explains the server-side route of events to Meta. Direct import of costs from Meta into GA4 has another purpose, described in the guide to connecting Meta Ads with GA4.
Do not try to solve every layer with one tag. First define the event, then consent, transfer, validation, and only then the report.
When GTM is not necessary
For a very simple website with one supported analytics tag, direct deployment of the Google tag may be clearer. GTM makes sense when you need more events, services, conditions, and a controlled change process. It is not a compulsory badge of grown-up marketing.
If your container has grown over several years and no one dares publish it anymore, I would not start by adding another tag. I would start with an inventory and one test path from the data layer to the report. You can describe the current situation through contact.