Skip to content

Set Up A/B Testing on Your Store

Before your A/B tests can show to shoppers, Dialogue needs to be switched on in your store. On Shopify this is a single switch in your theme. No code changes, and it won’t slow down your store.

  1. In your Dialogue dashboard, open A/B testing from the left menu.
  2. In the Setup Status box, click Show install steps. You’ll see the steps below, plus the script for other platforms.
  3. Open your Shopify Admin.
  4. Go to Online Store → Themes and click Customize on your active theme.
  5. Click App embeds in the left sidebar.
  6. Switch on Dialogue AB Commerce.
  7. Click Save in the top right.

That’s it. You can now create your first test.

If you installed the standalone Dialogue A/B testing app from the Shopify App Store, your dashboard is at ab.nowdialogue.com.

  1. Open Online Store → Themes in your Shopify Admin and click Customize on your active theme.
  2. Click App embeds in the left sidebar.
  3. Find Dialogue by PDQ and switch it on.
  4. Click Save.

Back in the A/B testing dashboard, the setup status shows when Dialogue is active on your store.

If your Shopify store runs on a custom storefront (Hydrogen, Next.js or another framework), the theme app embed can’t reach it. Your developer adds the Dialogue script to the site’s code once instead.

  1. Open A/B testing in your Dialogue dashboard, click Show install steps and choose Headless store.

  2. Copy the snippet. It looks like this, with your own store’s file name:

    <link rel="preload" href="https://cdn.nowdialogue.com/prod/stores/extension_script/<your-file>.js" as="script">
    <script defer src="https://cdn.nowdialogue.com/prod/stores/extension_script/<your-file>.js"></script>
  3. Add it to the <head> of the layout that every page uses.

  4. If your site has a Content Security Policy, allow https://*.nowdialogue.com for scripts, styles, images and connections.

  5. Keep the Dialogue app installed in Shopify. Purchases are counted from Shopify’s checkout.

Hydrogen adds a Content Security Policy by default. In app/entry.server.jsx, add our domain:

const {nonce, header, NonceProvider} = createContentSecurityPolicy({
shop: {checkoutDomain: context.env.PUBLIC_CHECKOUT_DOMAIN, storeDomain: context.env.PUBLIC_STORE_DOMAIN},
scriptSrc: ['https://*.nowdialogue.com'],
connectSrc: ['https://*.nowdialogue.com'],
styleSrc: ['https://*.nowdialogue.com'],
imgSrc: ['https://*.nowdialogue.com'],
});

Then in app/root.jsx, add the script inside <head> with the page nonce:

const nonce = useNonce();
// inside <head>
<script nonce={nonce} defer src="https://cdn.nowdialogue.com/prod/stores/extension_script/<your-file>.js" />

In the root layout (app/layout.tsx, or pages/_document.tsx on the older Pages Router), add the script inside <head>:

<head>
<script defer src="https://cdn.nowdialogue.com/prod/stores/extension_script/<your-file>.js" />
</head>

Open your store and, in the browser console, type window.DAI_EXP_MANAGER. If it returns something other than undefined, the script is running.

  • Page changes without a reload. Tests are checked on each full page load. If your site switches pages without reloading, a test set for one page starts when the shopper lands on or reloads that page.
  • Page types. Tests aimed at a page type (product, collection, cart) read it from the address, such as /products/... and /collections/.... If your addresses look different, set the page type before the script loads, for example window.DAI_shopify_template = 'product'.
  • Theme template tests switch between Shopify theme templates, so they don’t apply to a custom storefront.
  • Purchases. Shopify’s checkout runs on a different web address from a custom storefront, so some purchases may not be linked to the version a shopper saw. Views and clicks are counted as usual.
  1. Open A/B testing in your Dialogue dashboard.
  2. Click Show install steps and choose Manual Code.
  3. Copy the script and paste it into the <head> section of your site.

You no longer need the Chrome extension. Tests are built in the visual editor inside your dashboard. The extension is only a backup for the rare case where the editor can’t load a preview of your store. If that happens, the editor shows a Download Extension button.

Need help? Open the chat in your Dialogue dashboard and ask Dia, or ask to talk to a person.