Skip to content

Ads and analytics

Google Tag Manager: what it is and how to install it

Google Tag Manager is a free service that manages analytics and advertising tags from one place. We explain how it works, how to install the container on a site and how to check the setup.

Google Tag Manager (GTM) is a free service where you manage analytics tags, advertising tags and other scripts from a single account, without constantly editing the site's code. The container code is added to the site once, and then tags are added, changed and switched off in the GTM interface after testing and publishing.

In brief

  • GTM is a container for tags: Google Analytics 4, the Meta pixel, ad events and other scripts.
  • The container code is installed on the site once; later changes are made in the GTM account.
  • Tags fire on triggers: page view, click, form submission, scrolling.
  • Before publishing changes, use preview mode and check the events.
  • GTM requires order: names, access rights and version history help avoid chaos.

What a tag, a trigger and a variable are

GTM has three basic concepts, and understanding them makes the interface clear.

  • Tag is a piece of code that sends or runs something: an event in Google Analytics 4, an ad conversion, a Meta pixel event.
  • Trigger is the condition under which a tag fires: opening a page, clicking a button, submitting a form, viewing a certain section.
  • Variable is a value used in tags and triggers: the page address, the button text, the measurement ID, the order value.

Together they form a container. Changes reach the site only after you click publish, and every publication creates a new version that you can return to.

Why you need GTM

Without a tag manager, every new script has to be inserted into the site's code. This requires a developer, increases the risk of errors and leads to a mess: some codes sit in the template, some in a plugin and some are inserted by hand. GTM centralizes everything:

  • a marketer can add an event tag without asking a developer for every change;
  • you can see which tags are working, and they have clear names;
  • version history lets you quickly roll back a mistake;
  • preview mode shows which tags fired on a page;
  • access can be split between team members.

For a simple site, GTM is not required. If you only need basic analytics, connecting Google Analytics 4 directly is sometimes enough, as described in the article on connecting GA4. GTM becomes useful when there are several tags and you need events: a form, a click on a phone number, a cart, a purchase.

How to create an account and a container

  1. Go to the Tag Manager site and sign in with a Google account that belongs to your company.
  2. Create an account: company name and country.
  3. Create a container: the site name and the Web type.
  4. Accept the terms of service if you agree with them.
  5. Save the two code snippets the system shows: one for the head, the other for the body.

We recommend creating the account with the company e-mail; do not use the personal e-mail of an employee or contractor for this. Then access to the settings does not depend on one person.

How to install GTM on a site

The container code consists of two snippets. The first script goes as high as possible in the head section, the second, a small block for cases without JavaScript, right after the opening body tag. The way to insert them depends on the platform:

PlatformHow to insert
WordPressThrough the theme template or a dedicated code-insertion plugin, following its instructions
HoroshopThrough the settings section for code in the head and body; the platform documentation lists the current names of the items
Site builder or template siteThrough the field for custom code or integrations in the settings
Custom siteA developer adds the snippets to the common template of all pages

It is important to insert the code on all pages and only once. A double installation leads to duplicated events and distorted figures in reports.

The first tag: Google Analytics 4

The most common first step is connecting GA4 through GTM:

  1. In GA4, copy the measurement ID; it starts with the letter G.
  2. In GTM, create a new tag of the Google tag type or a GA4 configuration tag (the name depends on the interface version).
  3. Paste the measurement ID.
  4. Choose the all pages view as the trigger.
  5. Save the tag and move on to testing.

Further events, for example a form submission or a purchase, are added as separate tags with the corresponding triggers. For a store, the set of events is covered in the article on e-commerce in GA4. On some platforms, purchase events are passed by the site itself through the data layer (dataLayer), and GTM forwards them to analytics.

How to check that everything works

Before publishing, use preview mode (Preview). It opens your site with a debug panel that shows which tags fired on each action. Check that:

  • the GA4 tag fires once on every page;
  • the form event fires only after a successful submission;
  • there are no duplicate tags or events;
  • your actions appear in the GA4 real-time report.

When everything is fine, click publish, give the version a clear name and a short description of the changes. This habit helps when half a year later you need to understand what changed.

How to keep the container in order

  • Give tags, triggers and variables consistent names: platform, event, condition.
  • Delete unneeded tags instead of leaving them disabled for years.
  • Grant rights according to role: who only views, who edits, who publishes.
  • Do not add tags from unknown services without checking them: they increase load time and may collect data.
  • Follow the rules on cookie consent. Requirements change, so check them with a lawyer and set up the banner accordingly.

Which events a small business should track

You do not need to collect everything. To start, a few events tied to your goal are enough:

  • submission of a request or callback form;
  • a click on the phone number;
  • a click on a messenger or e-mail button;
  • adding a product to the cart and starting checkout;
  • a successful order or purchase;
  • views of key pages, for example prices or contacts.

Each event should answer a practical question: where requests come from, which pages lead to them, where people stop. If there will be no answer, the event is redundant. Start small and add new ones when you see that they are needed for decisions.

What the data layer is in plain language

The data layer (dataLayer) is a list of messages that the site passes to GTM: for example, that a user added a product to the cart, with its name, price and quantity. GTM listens to these messages and fires the necessary tags. Thanks to this, GTM receives accurate data without a complicated search for elements on the page. For an online store, this scheme is more reliable than setup based on clicks, because it does not break when the design changes.

The data layer is usually set up by the platform's developer or a special module. It is enough for the owner to know that this option exists and to define the task properly: a list of the events you are missing and the parameters of each.

Common mistakes

  • Installing the code both directly on the site and through GTM. Events get duplicated.
  • Publishing changes without checking them in preview mode.
  • Creating the container under a contractor's personal account.
  • Adding too many unnecessary tags that slow the page down.
  • Leaving test tags and triggers after debugging.
  • Ignoring cookie consent and personal data requirements.

Questions and answers

Is Google Tag Manager paid?

The standard version is free. The terms of use and possible paid solutions are listed on Google's pages.

Does GTM slow down a site?

The container itself is small, and speed depends more on the number and complexity of the connected tags. Remove what is unnecessary and check speed after changes.

Do I need GTM if I have Horoshop or WordPress?

Not necessarily, but it is convenient when you need several analytics and advertising systems. Some integrations are built into the platform and connect without GTM.

Can I install GTM myself?

Yes, for a basic installation it is enough to insert two code snippets. More complex events, such as the cart or a purchase, are usually set up together with a developer.

Conclusion

Google Tag Manager lets you manage analytics and advertising tags from one place and make changes quickly without access to the code. Start with one container, GA4 and two or three important events, keep names consistent and always check changes before publishing. LightSEO can help set up analytics on your site and in your ads: consider Google ads and an SEO audit of your site, which also checks technical settings.

Read also