Google Tag Manager
If your website uses Google Tag Manager (GTM), you can deploy the A vs B snippet as a GTM tag instead of editing your website's code directly. This is useful for teams where marketers manage tags without developer involvement.
Before you start
You will need access to a GTM container that is already installed on your website. If GTM is not yet set up, install it first using Google's instructions, then come back here.
You will also need your A vs B snippet tag from Project Settings → Snippet in the A vs B dashboard.
Step-by-step
Open your GTM container
Create a new tag
Choose Custom HTML as the tag type
Paste the snippet code
1<script2 id="avsb"3 src="https://cdn.avsb.cloud/snippet.js?id=YOUR_SNIPPET_KEY"4></script>YOUR_SNIPPET_KEY with the actual key from your project settings.Set the trigger to All Pages
If you only want experiments to run on specific pages, you can create a custom trigger that fires on those pages only — but typically you want the snippet on all pages.
Save the tag
Submit and publish the container
Verify installation
Testing with GTM Preview mode
Before publishing, use GTM's built-in Preview mode to confirm the tag fires correctly:
- Click Preview in the GTM workspace header.
- Enter your website URL and click Connect. GTM opens your website in a new tab with the debug panel.
- In the debug panel, look for your “A vs B Snippet” tag in the Tags list. It should show a green check and say Fired.
- You can also open your browser's DevTools Network tab and filter by “snippet.js” to confirm the snippet file loaded.
Single-page app considerations
If your website is a single-page application (React, Vue, Angular, etc.), GTM's “All Pages” trigger fires once on initial load — it does not automatically re-fire on client-side navigation. See Single Page Apps for how A vs B handles SPA navigation internally (no extra GTM configuration needed for this).