Popular Platforms

Step-by-step instructions for the most common website builders. Find your platform below and follow its guide.

Info

In every example, replace YOUR_SNIPPET_KEY with your real key from Project Settings → Snippet. The snippet is two tags: a tiny inline stub and the async loader. Both are needed, in that order. The stub is what hides the page before it paints, so pasting only the loader means visitors can see a flash of your original content. See Anti-Flicker.

WordPress

There are two good ways to install on WordPress. The plugin method is easier and doesn't touch your theme files.

1

Install the 'Insert Headers and Footers' plugin

In your WordPress admin, go to Plugins → Add New. Search for "Insert Headers and Footers" and install the plugin by WPBeginner, then activate it.

2

Open the plugin settings

Go to Settings → Insert Headers and Footers.

3

Paste the snippet

In the Scripts in Header box, paste your A vs B snippet tag and click Save.

Method 2: Editing header.php

1

Open the theme editor

Go to Appearance → Theme File Editor (or Appearance → Editor on newer versions). If you don't see this menu, your host may have disabled it; use the plugin method instead.

2

Open header.php

In the file list on the right, click header.php, the file that outputs your theme's <head>.

3

Paste the snippet

Find the opening <head> tag and paste your snippet tag right after it, as early as possible. Click Update File.

Child themes

Editing a parent theme's header.php directly means your change is wiped out on the next theme update. Use a child theme or the plugin method to make it permanent.

Shopify

1

Open your theme's code

In your Shopify admin, go to Online Store → Themes. Next to your active theme, click the ... menu and choose Edit code.

2

Open theme.liquid

In the file browser on the left, open Layout → theme.liquid. This file wraps every page in your storefront.

3

Paste the snippet

Find the opening <head> tag and paste your snippet tag on the very next line, before any other scripts.

4

Save

Click Save. The snippet is now live on your storefront.

Here's where it goes in theme.liquid:

Liquid
<head>  <!-- A vs B snippet -->  <script>  window.avsb=window.avsb||{};window.avsb.q=window.avsb.q||[];  window.avsb.ready=window.avsb.ready||function(f){window.avsb.q.push(f)};  window.avsb.on=window.avsb.on||function(n,f){var t=['on',n,f];window.avsb.q.push(t);return function(){t[0]=null}};  window.avsb.consent=window.avsb.consent||{set:function(s){window.avsb.q.push(['consent.set',s])},get:function(){return{}}};  window.avsb.track=window.avsb.track||{};['event','segment','purchase','cart'].forEach(function(m){window.avsb.track[m]=window.avsb.track[m]||function(a,b){window.avsb.q.push(['track.'+m,a,b])}});  (function(){window.avsb._t0=Date.now();window.avsb._df=fetch('https://cdn.avsb.cloud/YOUR_SNIPPET_KEY/datafile.json').catch(function(){});var d=document,e=d.documentElement,s=d.currentScript,a=s&&s.getAttribute('data-avsb-timeout'),t=a==null?3000:+a;if(!(t>0)||window.avsb.version)return;e.style.opacity='0';e.style.pointerEvents='none';window.avsb._t=setTimeout(function(){e.style.removeProperty('opacity');e.style.removeProperty('pointer-events')},t)})();  </script>  <script src="https://cdn.avsb.cloud/snippet.js?id=YOUR_SNIPPET_KEY" data-avsb="YOUR_SNIPPET_KEY" async></script>  {{ content_for_header }}  ...
Liquid14 lines

Webflow

1

Open Project Settings

In the Webflow Designer, click the W logo in the top left, then go to Project Settings.

2

Go to the Custom Code tab

Click the Custom Code tab.

3

Paste in the Head Code section

In the Head Code box, paste your snippet tag. Webflow injects this into the <head> of every page.

4

Save and publish

Click Save Changes, then publish your site. The snippet is only active on the published site, not in the Designer preview.

Squarespace

1

Open Code Injection

Log in to Squarespace and go to Settings → Advanced → Code Injection.

2

Paste in the Header section

In the Header box, paste your snippet tag. Squarespace puts everything here into the <head> of all pages.

3

Save

Click Save. The snippet is now active.

Plan requirement

Code Injection is only available on Squarespace's Business and Commerce plans, not the Basic plan.

Wix

1

Open Settings

In your Wix dashboard, click Settings in the left menu.

2

Go to Custom Code

Under Advanced, click Custom Code.

3

Add new custom code

Click + Add Custom Code and paste your snippet tag in the code box.

4

Set placement

Set Place Code in to Head, and Add Code to Pages to All Pages (or pick specific pages if you prefer).

5

Apply and publish

Click Apply, then publish your site. The snippet is now live.

Was this helpful?