/Docs

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.

GTM introduces a small delay
When you load the A vs B snippet through GTM, it fires after GTM itself loads. This adds a small delay compared to placing the snippet directly in your HTML. For experiments that change content above the fold, this extra delay increases the chance of visitors seeing a flicker. If flicker is a concern, consider placing the snippet directly in your HTML instead.

Step-by-step

1

Open your GTM container

Log in to tagmanager.google.com and open the container for your website. Make sure you are in the correct workspace.
2

Create a new tag

In the left sidebar, click Tags, then click New in the top right corner. Give the tag a descriptive name like “A vs B Snippet”.
3

Choose Custom HTML as the tag type

Click Tag Configuration. In the tag type picker, scroll down and select Custom HTML.
4

Paste the snippet code

In the HTML box, paste your A vs B snippet tag. The full tag to paste looks like this:
html
1<script
2 id="avsb"
3 src="https://cdn.avsb.cloud/snippet.js?id=YOUR_SNIPPET_KEY"
4></script>
Replace YOUR_SNIPPET_KEY with the actual key from your project settings.
5

Set the trigger to All Pages

Click Triggering. In the trigger picker, select All Pages. This ensures the snippet loads on every page of your website.

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.
6

Save the tag

Click Save. Your tag is now configured but not yet live.
7

Submit and publish the container

Click Submitin the top right corner of GTM. Add a version name like “Add A vs B snippet” and click Publish. GTM will push the updated container to your website.
8

Verify installation

Go back to Project Settings → Snippetin the A vs B dashboard. Wait a minute, then check if the status indicator has turned green. You can also verify using GTM's Preview mode — see below.

Testing with GTM Preview mode

Before publishing, use GTM's built-in Preview mode to confirm the tag fires correctly:

  1. Click Preview in the GTM workspace header.
  2. Enter your website URL and click Connect. GTM opens your website in a new tab with the debug panel.
  3. 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.
  4. 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).