A/B testing: what it is, how to do it right, and mistakes that ruin your tests
A/B testing compares two versions of an element to determine which converts better. Learn the correct methodology, common mistakes, and how to scale your...

Google Tag Manager (GTM) is a tag management system that allows you to add, modify, and remove code snippets (tags) on your website without directly editing the source code. In other words: it's the bridge between your website and all your measurement and marketing tools.
Without GTM, every time you need to track an event, install a conversion pixel, or activate a remarketing script, you depend on a developer. With GTM, a marketing or CRO professional can handle those implementations in minutes.
According to BuiltWith data, more than 35% of websites in the top 1 million use GTM. It's not a trendy tool — it's fundamental digital measurement infrastructure.
But beware: a poorly configured GTM is worse than no GTM at all. I've audited accounts with 40+ tags firing on every page, duplicating data in GA4 and slowing down page load. The tool is powerful; the problem is always the implementation.
GTM is built on three fundamental concepts:
These are the code snippets you want to execute. Examples: the GA4 script, the Meta Ads pixel, the Google Ads conversion code, Hotjar or Clarity scripts.
Each tag has a specific function: measure, track, personalize, or activate third-party features.
They define when a tag fires. Some examples:
These are dynamic values that GTM can read and use in tags and triggers. There are built-in variables (page URL, referrer, click text) and custom variables (dataLayer values, cookies, DOM elements).
The relationship is simple: a trigger activates a tag, and variables provide the data the tag needs to function correctly.
GTM will provide two code snippets: one for the <head> and another for right after the opening <body> tag.
The GTM snippet should go as high as possible in the <head> so it loads before any other tag. The second snippet (noscript) goes right after <body>.
Important: if you use a CMS like WordPress, use an official plugin or insert it via functions.php — don't paste it directly in the visual editor.
The first tag you should configure is Google Analytics 4:
Before publishing, always use GTM's Preview mode. Connect your website and verify that:
Custom events are GTM's real power. Example for tracking clicks on a CTA button:
cta_click).The dataLayer is a JavaScript array that acts as an intermediary layer between your website and GTM. It's the correct way to pass structured data.
Instead of GTM "scraping" data from the DOM (fragile and error-prone), your website pushes data to the dataLayer and GTM reads it reliably:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: 'T12345',
value: 89.99,
currency: 'EUR',
items: [{ item_name: 'Product X', price: 89.99 }]
}
});
Golden rule: all business data (transactions, leads, products viewed) should go through the dataLayer. Never rely on CSS selectors to capture critical data.
For a more advanced guide on server-side implementation, check out our article on server-side tracking with GTM.
| Aspect | Client-side (GTM Web) | Server-side (GTM SS) |
|---|---|---|
| Where it runs | User's browser | Your own server (GCP, AWS, etc.) |
| Performance impact | High (each tag = more JS in the browser) | Minimal (processing on server) |
| Privacy | Data exposed to the browser | Data processed on your own server |
| Ad-blocker resistance | Low (blocked by many) | High (tracking comes from your domain) |
| Cost | Free | Cloud server (~€30-100/month) |
| Complexity | Low-medium | High (requires infrastructure and expertise) |
Practical recommendation: start with client-side. Migrate to server-side when you have significant traffic volume (>100K visits/month), need to improve data quality, or operate in sectors with strict privacy regulations.
I've audited more than 100 GTM implementations. These are the mistakes I see over and over:
Mistake 1: Duplicate tags. Having GA4 installed in GTM AND also in the source code. Result: data inflated by 2x.
Mistake 2: Not using Preview mode before publishing. Every change published without verification is a ticking time bomb. A misconfigured trigger can fire a tag on every page — or none.
Mistake 3: Triggers that are too broad. An "All Pages" trigger for a tag that should only fire on the thank you page. I've seen conversions reported at 50x above reality because of this mistake.
Mistake 4: Ignoring firing order. GA4 Config must fire before any GA4 event. If the event arrives before the configuration, it's lost.
Mistake 5: Not documenting. With 20+ tags, 30+ triggers, and 40+ variables, without documentation nobody knows what anything does. Use a strict naming convention and a control spreadsheet.
Mistake 6: Not configuring Consent Mode. With GDPR and ePrivacy regulations, firing tags before obtaining user consent is a real legal risk.
For more analytics configuration mistakes, check out our guide on common GA4 configuration errors.
Since 2024, Google requires Consent Mode v2 to use remarketing and advanced measurement in the EU. In 2026, this is non-negotiable.
What it means for your GTM:
ad_storage, analytics_storage, ad_user_data, ad_personalization).analytics_storage; Meta Pixel requires ad_storage + ad_user_data.A disorganized GTM container is unmaintainable. Use these conventions:
Tags: [Platform] - [Type] - [Detail]
GA4 - Config - BaseGA4 - Event - PurchaseMeta - Pixel - PageViewHotjar - Script - BaseTriggers: [Type] - [Condition]
PV - All PagesPV - Thank You PageClick - Main CTACE - Purchase DataLayerVariables: [Type] - [Descriptive name]
DLV - Transaction IDDLV - Product NameCSS - Click ClassesDocument it in a shared spreadsheet and update it with every change.
Every tag you add is JavaScript that the browser must download, parse, and execute. The cumulative impact can be brutal.
Best practices:
A site with 15 poorly managed tags can lose 2-3 seconds of load time. On mobile, that means a 30% increase in bounce rate.
GTM isn't the destination — it's the foundation. Without a solid GTM implementation, all subsequent analyses and optimizations are built on unreliable data.
The correct sequence is: well-implemented GTM → reliable data in GA4 → actionable analysis → CRO hypotheses → A/B tests → measurable impact.
To build a complete data-driven strategy on this foundation, check out our data-driven strategy guide.
If you'd like us to audit your GTM implementation and help you turn data into conversions, at Boost we specialize in CRO. Start with a free diagnostic at Scan&Boost.
Adrià Vidal is the founder of Boost. +1,000 optimization actions, +47.8% average conversion uplift per client, +€7.8M in additional revenue generated.
A/B testing compares two versions of an element to determine which converts better. Learn the correct methodology, common mistakes, and how to scale your...
Learn what process automation is, its real benefits, and how to implement it step by step to reduce costs and scale your business.
The customer journey defines every touchpoint between your brand and the customer. Learn how to map its stages, detect friction, and optimize each step to...