Promoting your online store becomes much easier when you understand your customers’ behavior.
Imagine a customer visits your website, views a product, adds it to their cart — but then leaves without completing the purchase. You don't know why they left. To find out and improve your website, you need detailed data about each action your customers take: what they looked at, what they chose, and most importantly, at what step they decided to leave.
In this article, we’ll explain step-by-step how to use Google Tag Manager (GTM) to track every customer action — from product views to completed orders. This way, you'll clearly see what prevents customers from buying and how to fix it.
What is Google Tag Manager, and why do you need it?
Google Tag Manager is a free tool from Google. It lets you easily add and manage tracking codes on your website without relying on a programmer. Everything is done through an easy-to-use interface.
Previously, to know who clicked the “Buy” button, you needed a developer to insert special code. With GTM, you can set this up yourself in just a few clicks.
With GTM, you can track important actions, such as:
Which products customers view most often;
Items that customers add to their carts;
Steps in the checkout process where customers leave;
Products customers buy, and products they ignore.
How Google Tag Manager works
Your website collects customer actions and stores them in a special place called the dataLayer.
Think of the dataLayer as a detailed notebook where your site records customer actions like “Customer viewed running shoes,” “Customer added item to cart,” or “Customer left during payment.”
For websites from 4Partners, this dataLayer is already built-in. You only need to set up how this information is sent to Google.
Google Tag Manager itself doesn't analyze the data — it only gathers it. To turn this collected data into clear insights, you need Google Analytics. GTM sends detailed information there, such as:
Products viewed by customers;
The total value of purchases;
The checkout stage at which customers leave.
As a result, you receive a clear picture of your visitors’ behavior and can make decisions based on accurate data rather than guesses.
How to set up Google Tag Manager
Step 1. Activate data collection
First, open Google Analytics, go to Admin → Data Streams, and enable the “Enhanced measurement” option. This allows Google Analytics to start collecting detailed data about your users.
Step 2. Set up Google Tag Manager on your site
If Google Tag Manager hasn't been installed yet, a developer should do it once by adding a specific code to your website. After that, you’ll manage everything easily yourself using the GTM interface. Alternatively, you can contact 4Partners’ support—we can help set up GTM for free.
Step 3. Specify what actions you want to track
Inside Google Tag Manager, clearly indicate what user actions you want to track, such as:
Viewing a product;
Adding products to the cart;
Starting the checkout process;
Completing a purchase.
GTM provides ready-made templates—you simply select what you need, just like filling out a form.
Go to Google Tag Manager → Variables.
Click "New".
Name it clearly, e.g., “GTM E-commerce DataLayer”.
Set the variable type as “Data Layer Variable”.
This variable captures key information from your website, such as products in the cart, delivery costs, or the order number.
Example:
Examples of useful variables:
ecommerce.items — List of products ordered.
ecommerce.value — Total purchase amount.
ecommerce.shipping — Delivery cost.
ecommerce.currency — Currency of the purchase.
ecommerce.affiliation — Your store’s name.
ecommerce.transaction_id — Order number.
Step 4. Send your data to Google Analytics
Next, you'll configure GTM to pass this collected data into Google Analytics. Within GTM, you'll set an action (for example, "purchase"), indicate where data should go, and save your settings.
Effectively, you're telling the system: “If a customer completes a purchase, send data to Google Analytics, including what was bought, the purchase value, and shipping costs.”
Create two tags:
Tag 1: Tracking customer actions before purchase
Name: GA4 - GTM_without_purchase
Type: GA4 Event
Event Name: {{Event}}
Parameter: items = {{ecommerce.items}}
This tag tracks actions like viewing products, adding to cart, and starting checkout—everything except the actual purchase.