Talkoly Guide

How to set up Google Tag Manager for an online store, step by step

Guides2 December 202618 min read4175 words

Google Tag Manager (GTM) is a free Google tool that lets an online store add GA4, Google Ads, Meta Pixel, live chat and other scripts without editing the site’s code every time. This guide explains what containers, tags, triggers, variables and the dataLayer are, how to install GTM on Horoshop, OpenCart, WordPress and Tilda, how to send product views, add-to-cart and purchase events to GA4, how to test everything in Preview mode, and how to avoid duplicate tracking.

🏷️
In short
  • Google Tag Manager is a “container” on your site: you add its code once, then manage analytics and ad tags in a web interface.
  • Three core concepts: a tag (what to do), a trigger (when) and a variable (which data to use). The site passes purchase data through the dataLayer.
  • Horoshop has a field for the container ID and pushes view_item, add_to_cart and purchase events to the dataLayer on its own. On WordPress, use Site Kit by Google or GTM4WP.
  • No change goes live until you click Submit → Publish. Test everything in Preview (Tag Assistant) first.
  • The main risks are double-counting GA4 (via GTM and directly at the same time) and piles of Custom HTML scripts that slow the site down.

Google Tag Manager means you no longer have to ask a developer for every new pixel or analytics event. You install the GTM code once. After that, the owner or a marketer manages tags in the browser and tests every change before it goes live.

Menu names below match Google’s English interface as of November 2026. Facts about the service come from Google’s official help center.

What is Google Tag Manager, in plain terms

Google defines Google Tag Manager as a tag management system. A “tag” is a snippet of code that sends data to a third-party service: GA4, Google Ads, Meta Pixel, TikTok Pixel, Hotjar or a live chat. Without GTM, each snippet goes into the site template separately. With GTM, the template holds only the container code, and everything else lives inside the container.

You sign in at tagmanager.google.com with a regular Google account. The standard version is free. The paid Tag Manager 360 is part of the enterprise Google Marketing Platform suite, and a small store does not need it.

What GTM is not

  • It is not analytics. GTM does not count anything or show reports. It only delivers data to GA4, ad accounts and other tools.
  • It does not replace UTM tags. GA4 learns where a shopper came from through the link, not through GTM. See UTM tags explained.

Why use Google Tag Manager for ecommerce, and when you can skip it

A store rarely runs just one script. There is GA4, Google Ads conversions, the Meta pixel, sometimes TikTok, a heatmap and live chat. Each one wants to know about product views, carts and purchases, and GTM handles all of them in one place.

TaskWithout GTMWith GTM
Add an ad pixelEdit the template, get FTP or theme admin accessA new tag in the web interface, tested in Preview
Track clicks on your phone number or ViberWrite JavaScript for every buttonA click trigger and a GA4 tag, no code
Send a purchase to GA4, Ads and MetaThree separate scripts on the thank-you pageOne purchase event in the dataLayer, three tags
Undo a mistakeHunt for what changed in the templateRoll back to an earlier container version
Give a contractor accessShare the site admin passwordSeparate access to the container only

When you don’t need GTM. If all you run is GA4 and your CMS has a built-in field for it, an extra layer of complexity buys you nothing. Once you add a second ad platform or purchase events, GTM starts saving time.

How Google Tag Manager works: container, tags, triggers, variables

GTM has four levels. An account usually represents the company. A container is the set of tags, triggers and variables for one website or app. A store needs a Web container. Inside the container you work in a Workspace, a draft that does not affect the site until you publish.

Google Tag Manager tag, trigger and variable example: a Click Just Links trigger with a tel: condition, the Click URL variable and a GA4 Event tag sending click_phone
The trigger decides “when,” the variable “what,” and the tag “where to send it.”

Tags

A tag is an action: “send an event to GA4,” “report a conversion to Google Ads,” “load the chat code.” GTM offers built-in Google tag templates, a Community Template Gallery and a Custom HTML type for any code. Google recommends templates: according to its help center, built-in templates are the best way to avoid performance problems and malicious code.

Triggers

A trigger tells a tag when to fire. Google’s help center lists these trigger types:

Trigger typeWhen it firesStore example
Consent InitializationFirst on the pageCookie consent settings
InitializationRight after thatThe Google tag for GA4
Page View, DOM Ready, Window LoadedAt different stages of page loadA pixel, the chat code
Click (All Elements / Just Links)A click on an element or a link“Call us” and “Message us on Viber” buttons
Form SubmissionA form is submittedA “Call me back” form
Scroll Depth, Element VisibilityScrolling, a block appearing on screenWhether shoppers reach the reviews on a product page
Custom EventAn event from the dataLayeradd_to_cart, purchase

There are also History Change, Timer, JavaScript Error, YouTube Video and Trigger Group. Page view triggers fire in this order: Consent Initialization → Initialization → Page View → DOM Ready → Window Loaded.

Variables

A variable is a value a tag or trigger reads when an event happens: the page URL, the button text, the order total. Built-in variables are grouped by topic: Pages (Page URL, Page Path, Referrer), Clicks (Click URL, Click Text, Click ID), Forms, Scroll, Videos and Utilities (Event, Container ID). You turn them on under Variables → Configure. You can also create User-Defined Variables, for example a Data Layer Variable that reads the order number from the dataLayer.

The dataLayer: how your site passes data to GTM

GTM can see buttons, URLs and clicks, but it does not know what is in the cart or what the order number is. Your site has to pass that data itself, through the dataLayer.

According to Google’s documentation, the dataLayer is a JavaScript object that GTM and gtag.js use to pass information to tags. The site pushes an event into it with dataLayer.push(), a Custom Event trigger catches it, and variables pull out the fields you need.

Data flow: the store website pushes view_item, add_to_cart and purchase events to the dataLayer, and the GTM container sends them to GA4, Google Ads, Meta Pixel and other scripts
The site records an event once, and GTM sends it to every service that needs it.

Five rules from the same documentation that people get wrong most often:

  • Declare the dataLayer with window.dataLayer = window.dataLayer || []; once per page, above the container code.
  • Never overwrite it with dataLayer = [...]: that wipes out data already stored.
  • Add new events only with dataLayer.push().
  • The name is case-sensitive: datalayer.push() will not work, you need dataLayer.push().
  • The special event key holds the event name that triggers listen for.

If you want to set things up without a developer, keep this in mind: the product dataLayer has to come from your CMS or a module. So first check whether your platform already sends ecommerce events. More on that below.

How to install Google Tag Manager on your site, step by step

Step 1. Account and container

  1. Go to tagmanager.google.com and sign in with a Google account. Use the store’s business account, not a contractor’s personal one.
  2. Open the Accounts tab → Create Account. Enter the account name (your store name) and country.
  3. Name the container after your domain, for example shop.ua. Choose Web as the target platform.
  4. Click Create and accept the Terms of Service.

The steps follow Google’s “Create an account and container” article. The container ID looks like GTM-XXXXXXX and appears in the top bar.

Step 2. The container code

Open the code with the Install Tag Manager button in your workspace, or click the container ID → Install Manually. Note that in Google’s current help article the code is a single block that goes as high in the <head> of every page as possible. It looks like this (your code will have your own ID instead of GTM-XXXXXXX):

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->

Copy the code from your own container, not from this article. The previous version had two parts: a script in the <head> and a <noscript> block right after the opening <body> tag. Google says sites with the older code don’t need to reinstall it, which is why many platforms still have separate “head” and “noscript” fields.

Once the code is in place, enter your site URL in the install dialog and click Test to let GTM check that it can see its code.

Horoshop

Horoshop, a popular Ukrainian ecommerce platform, needs no code pasting. Per the Horoshop help center: go to Marketing → Marketing services and open the GTM - Google Tag Manager (head) settings. Paste only the container ID into the Tracking ID field, tick the active box and save. Repeat for GTM - Google Tag Manager (noscript): the ID has to be entered in both.

The best part is that Horoshop pushes the view_item_list, view_item, add_to_cart, remove_from_cart, begin_checkout and purchase events to the dataLayer on its own, plus callbackRequest for callback requests. It also provides a ready-made GA4 container JSON file: import it via Admin → Import Container and replace the G-0000000000 placeholder with your own ID. Caveats from the same article: the events don’t include category or brand, and purchase fires when the checkout button is clicked, so unpaid orders reach GA4 too. If GA4 runs through GTM, don’t also enable it in Marketing services. To add live chat to the same store, see live chat for Horoshop.

WordPress and WooCommerce

There are two proven routes that don’t involve editing the theme. Google’s own Site Kit by Google plugin connects Tag Manager without touching code. The GTM4WP plugin (over 700,000 active installations as of November 2026) adds the container code and also pushes GA4 ecommerce events for WooCommerce to the dataLayer. For WooCommerce, the second one is more convenient precisely because of those events. For chat on WordPress, see live chat for WooCommerce.

OpenCart

Core OpenCart has no GTM field, so you have two options. The first is to paste the code into the theme’s header template (header.twig in OpenCart 3 and 4, header.tpl in OpenCart 2) after backing up the file. The second, and better, option is a GTM module from the OpenCart Marketplace, which usually builds ecommerce events in the dataLayer as well. Before buying, check which GA4 events it sends and which OpenCart version it supports. For chat on this platform, see the OpenCart live chat module.

Tilda and other platforms

In Tilda, according to the builder’s help center, you enter the container ID under Site Settings → Analytics (the Google Tag Manager field), save, and republish the whole project so the code appears on every page. On other site builders, look for a “code in head” field or a dedicated GTM integration. Prom.ua, Ukraine’s large marketplace, most likely does not allow third-party code on company sites, so you can’t add your own container there.

GTM and GA4 setup: the Google tag and ecommerce events

The base GA4 tag

You will need your GA4 measurement ID (it starts with G-). Then follow Google’s instructions:

  1. In the Workspace tab, open Tags → New.
  2. Name the tag, for example “GA4 — Google tag.”
  3. Tag Configuration → choose Google Tag → paste the G- ID into the Tag ID field.
  4. Triggering → Initialization – All Pages.
  5. Click Save. Don’t publish yet: add the events first and test everything in Preview.

GA4 ecommerce events in the dataLayer

Here are a store’s three key events in the format from the GA4 ecommerce documentation for Tag Manager. The values are an example from a Ukrainian tableware store, so product names stay in Ukrainian and prices are in hryvnias (UAH). Clear the ecommerce object before each event so data from the previous product doesn’t carry over to the next one.

<script>
window.dataLayer = window.dataLayer || [];

// 1. Product page view
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "view_item",
  ecommerce: {
    currency: "UAH",
    value: 450,
    items: [{
      item_id: "CUP-350",
      item_name: "Чашка керамічна 350 мл",
      item_category: "Посуд",
      price: 450,
      quantity: 1
    }]
  }
});

// 2. Add to cart (2 cups)
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "add_to_cart",
  ecommerce: {
    currency: "UAH",
    value: 900,
    items: [{
      item_id: "CUP-350",
      item_name: "Чашка керамічна 350 мл",
      price: 450,
      quantity: 2
    }]
  }
});

// 3. Purchase — only on the order confirmation ("thank you") page
dataLayer.push({ ecommerce: null });
dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "10245",
    currency: "UAH",
    value: 1200,
    shipping: 0,
    items: [
      { item_id: "CUP-350", item_name: "Чашка керамічна 350 мл", price: 450, quantity: 2 },
      { item_id: "PLT-24", item_name: "Тарілка 24 см", price: 300, quantity: 1 }
    ]
  }
});
</script>

Check the math: 450 × 2 + 300 × 1 = ₴1,200. In the documentation, value is the sum of price × quantity for all items, while shipping and tax go in the separate shipping and tax fields. Minimum requirements from the same page: every item needs item_id or item_name (ideally both), currency must be set together with value, and transaction_id is required for purchases and refunds.

Event tags in GTM

  1. Triggers → New → Custom Event. Enter add_to_cart in the Event name field. Create triggers for view_item and purchase the same way.
  2. Tags → New → Google Analytics: GA4 Event. Enter your G- ID and the event name: add_to_cart.
  3. Under More Settings → Ecommerce, check Send Ecommerce data and set Data Source to Data Layer. The tag will then pull items, value and currency from the dataLayer on its own.
  4. Attach the trigger and save. Repeat for the other two events.

Give tags clear names. Nobody will recognize “Tag 17” six months from now, but anyone will understand “GA4 — Event — purchase.”

Preview mode (Tag Assistant) and publishing

Everything you have built so far is a draft that visitors don’t see. That is GTM’s biggest safety net, and also the most common reason people ask “why isn’t anything working?”

Testing in Preview

Per Google’s help center:

  1. In your workspace, click Preview (top right). Google Tag Assistant opens in a new tab.
  2. Enter your site URL and click Connect. The site opens in a new window marked Connected. If pages break, uncheck Include debug signal in the URL.
  3. Go back to the Tag Assistant tab and click Continue.
  4. Walk through the shopper journey: product page → cart → test order. At each step, check which tags fired and what data went into the dataLayer.
  5. To finish, click the X at the top left of the Tag Assistant interface, or Stop debugging on its start page.

At the same time, open the Realtime report in GA4: the events from your test order should show up there.

Google Tag Manager pre-publish checklist: tag fired once, purchase has transaction_id, no second GA4, events in Realtime, cookie consent, tag names, version name
Nine checks worth running before every container publish.

Publishing and versions

  1. Click Submit at the top right and choose Publish and Create Version.
  2. Review the Workspace Changes list for anything you changed by accident.
  3. Fill in Version Name and Version Description, for example “GA4 ecommerce: view_item, add_to_cart, purchase.”
  4. Click Publish.

Every publish is saved as a version, a snapshot of the container at a point in time. If something breaks after publishing, go to Versions, open the Actions menu next to the last working version, choose Set as Latest Version (it replaces the draft) and publish it again. Alternatively, open that version from the table and choose Actions → Publish.

Access for your team and contractors

A container has five permission levels: No access, Read, Edit, Approve and Publish. Edit is enough for a contractor: they make changes, and you publish. Add users under Admin → User Management (the Container column controls container access, the Account column controls account access). The store itself should remain the account owner.

Consent Mode v2: does a Ukrainian store need it?

Consent mode changes how Google tags behave based on what a visitor chose in the cookie banner. It is not a banner itself: you or a consent management platform (CMP) provide the banner, and consent mode passes the visitor’s choice to the tags. For Google ads and analytics, there are four main parameters: ad_storage, analytics_storage, ad_user_data and ad_personalization. The last two were added in v2.

In basic mode, Google tags send nothing until the visitor makes a choice in the banner. In advanced mode, they send cookieless data. Google stresses that the site owner is responsible for obtaining consent.

What this means for a store in Ukraine. Ukraine is not part of the European Economic Area (EEA). Google’s EEA consent requirements depend on where the user is: if someone in the EEA visits your site, their consent choice has to be passed to Google. So:

  • You sell and advertise only in Ukraine: the EEA requirement does not apply to you directly. But visits from Ukrainians living in Poland, Germany or Czechia count as EEA traffic.
  • You ship to or advertise in the EU: you need a consent banner and consent mode v2. According to the same article, advertisers must comply with Google’s EU User Consent Policy (EU UCP) to use personalized ads and measurement for those visitors.
  • In every case: Ukrainian personal data law applies regardless of Google’s rules. List the services that collect data in your website privacy policy.

In GTM, consent mode is usually set up with a CMP template on the Consent Initialization – All Pages trigger, which fires first. Whether you need consent, and how much, is a legal question, so check with a lawyer.

Server-side GTM: the short, honest version

A regular container runs in the visitor’s browser. A server-side container runs on a server you control, in your own Google Cloud project or another environment. The browser sends data to your server, and from there it goes on to GA4, ad platforms and other tools. According to Google, only you can see the data on that server until you choose to pass it on.

For a small store, this is a later stage, not a first step: you need separately paid hosting and someone to maintain it. Consider it once ads drive a noticeable share of sales and conversion accuracy affects your budget.

What else to add through GTM: Meta Pixel, live chat, UTM

  • Meta Pixel. Add the base code with a Custom HTML tag on All Pages, or with a template from the gallery. Attach the Purchase and AddToCart events to the same Custom Event triggers you use for GA4, so both systems count the same purchases.
  • Google Ads. A conversion tag on the purchase trigger, with the value and order ID taken from Data Layer Variables.
  • Clicks on phone numbers and messengers. A Click – Just Links trigger with the condition Click URL contains tel:, viber: or t.me, plus a GA4 Event tag.
  • Live chat. If you can’t access the site template, you can add a chat widget with a Custom HTML tag on the All Pages trigger. That is one way to install live chat for your website from Talkoly: paste the code from the dashboard into the tag. The Check installation button won’t find the code in the HTML, because GTM injects it after the page loads. The dashboard marks the site as connected as soon as the widget first opens for any visitor. Step-by-step instructions are on the installation page.
  • UTM tags. GTM doesn’t create UTM tags, but GA4 uses them to attribute dataLayer purchases to sources. You can build links for newsletters, Stories and Viber with the UTM builder. From the Business plan, the Talkoly chat adds utm_source=talkoly&utm_medium=chat to clicks from product cards, so chat sales show up in GA4 as a separate source.

Common GTM mistakes and risks for online stores

MistakeResultFix
GA4 is installed both directly (theme, plugin, CMS settings) and through GTMDouble page views and purchases, a misleading conversion rateKeep a single source. In Preview, every tag should fire once
purchase fires on every reload of the thank-you pageInflated revenue and ROASAlways send a unique transaction_id: GA4 deduplicates purchases with the same ID. Don’t send an empty ID, or GA4 will treat all such purchases as duplicates
Changes saved but not published“Nothing works”Submit → Publish
Dozens of Custom HTML tags loading librariesA slower site, especially on phonesTemplates instead of Custom HTML, a quarterly cleanup of unused tags
A click trigger on the form buttonFailed attempts with field errors get counted tooA Form Submission trigger, an event after successful submission, or a redirect to a thank-you page
The container lives in a contractor’s email accountYou lose access to all your analyticsKeep the account on the store’s business email, give the contractor Edit access
Someone else’s code pasted into Custom HTMLRisk of malicious code on the payment pageOnly code from the services’ official dashboards

Does GTM slow down your site?

The container code loads asynchronously (the async attribute in Google’s snippet), so on its own it doesn’t block the page from rendering. What slows things down is the tags inside: every pixel means extra requests and JavaScript. Keep only the tags whose data you actually look at, and remove the rest once a quarter.

What’s next: once add-to-cart and purchase events are flowing into GA4, find the step where shoppers drop off. These guides will help: the sales funnel for an online store and abandoned carts.

FAQ

What is Google Tag Manager, in simple terms?

It is a free Google service for managing analytics and ad code on your website. You add the container code once, then add GA4, Google Ads, Meta Pixel, chat and other scripts in a web interface. Every change can be tested before publishing and rolled back.

Is Google Tag Manager free?

Yes, the standard version of GTM is free for any website. The paid Tag Manager 360 is part of the enterprise Google Marketing Platform suite, and a small store doesn’t need it. The only cost you may face is hosting for a server-side container, if you ever need one.

How do I set up Google Tag Manager on my website?

Create an account and a Web container at tagmanager.google.com, click Install Tag Manager and copy the code. Paste it as high in the head of every page as possible, or enter the container ID in your CMS field: in Horoshop that is Marketing → Marketing services, and in WordPress you can use Site Kit or GTM4WP. Then check it with the Test button.

Do I need GTM if I already have GA4?

If you run no other scripts, you can do without GTM. It becomes useful once you add Google Ads, Meta Pixel, purchase events or phone click tracking. Never run GA4 directly and through GTM at the same time, or your data will double.

How do I set up GTM and GA4 ecommerce tracking for an online store?

Create a Google Tag with your GA4 G- ID on the Initialization – All Pages trigger. Then, for view_item, add_to_cart and purchase, create Custom Event triggers and Google Analytics: GA4 Event tags with Send Ecommerce data checked and Data Layer as the source. The product data itself has to be pushed to the dataLayer by your site or a module.

What is the dataLayer in Google Tag Manager?

The dataLayer is a JavaScript object on the page that your site uses to pass data to GTM: the event name, order total, items. A Custom Event trigger reacts to the event, and Data Layer Variables read the values you need. Declare the dataLayer above the container code and never overwrite it.

Why are my Google Tag Manager tags not working?

Most often the changes were saved but never published with Submit → Publish. The second most common reason is that the trigger waits for a different event, or the event name in the dataLayer differs in letter case. Open Preview and check whether the tag fired.

Does Google Tag Manager slow down a website?

The container code itself loads asynchronously and doesn’t block the page. The tags inside are what slow it down, especially Custom HTML with heavy libraries, so keep only the ones you need.

Does a store in Ukraine need Consent Mode v2?

Google’s consent requirements apply to visitors from the European Economic Area, and Ukraine is not part of it. If you ship to or advertise in the EU, you need a consent banner and consent mode v2. Even if your audience is Ukrainian, account for visits from Ukrainians abroad and talk to a lawyer.

Can I install live chat through Google Tag Manager?

Yes, most chats can be added with a Custom HTML tag on the All Pages trigger, followed by publishing the container. The chat dashboard’s installation check may not see the code in the HTML, because GTM injects it with a script. If a plugin or template access is available, installing the chat directly is simpler.

Try Talkoly in your storeLive chat with replies from Telegram, monobank payments and Nova Poshta tracking in the conversation. 14 days of all features free, then the free “Start” plan.

Read next