A/B testing with Google Tag Manager
If you can't edit your site's code but you have Google Tag Manager, you can still run A/B tests. Add AB Splits as a Custom HTML tag, publish the container, and create tests from the AB Splits dashboard.
Free plan · 1,000 visitors / month · no card
Set up in 4 steps
- 01In GTM, go to Tags → New → Tag configuration → Custom HTML.
- 02Paste the snippet into the HTML box.
- 03Set the trigger to Initialization - All Pages so it fires as early as GTM allows.
- 04Submit and publish the container, then click Check install in AB Splits.
GTM → Custom HTML tag
<script src="https://absplits.com/s.js" data-key="YOUR_SITE_KEY"></script>Your real site key is shown in the dashboard after you add your site.
- GTM itself loads asynchronously, so tests installed this way start a little later than a snippet placed directly in <head>. For headline tests above the fold, a direct install gives the smoothest result.
- Each tested visitor pushes an absplits_exposure event to the dataLayer, which you can use as a trigger for other tags.
What to test on Google Tag Manager
All 56 examples →Lead with the outcome, not the product category
Say what happens next on the button
Cut the form to the fields you actually use
Move customer logos above the fold
Swap a generic testimonial for one with a result
Sticky CTA bar on mobile
AI writes variants
Choose a headline or button and AI reads your real page to write 3–5 alternatives, each with its reasoning.
Honest stats
Chance to beat the original, 95% intervals, and a plain keep-running or stop verdict. No p-value guesswork.
Results in GA4
Every tested visitor is tagged in GA4, so any report can be split by variant.
Questions
Do I need a developer to install through GTM?+
No. Anyone with publish access to the GTM container can add the tag. After that, tests are created and started in AB Splits without touching GTM again.
Will my consent setup still apply?+
Yes. Add data-consent="wait" to the script tag and call ABSplits.consent() once the visitor accepts, or fire the tag only on your consent trigger.
Can I see results in Google Analytics 4?+
Yes. Every visitor in a test sends an absplits_exposure event to GA4 with the test and variant name, so you can break down any GA4 report by variant. AB Splits also shows its own Bayesian results.
Will visitors see the original flash before the variant?+
The snippet is 8 KB (about 3.5 KB compressed) and hides the page for at most 0.8 seconds while it applies the variant. Returning visitors get their version from a local cache almost instantly.
A/B testing on other platforms