Shopify A/B Testing Integration Convert Experiences

Do you like the ability of A/B and multivariate testing on your Shopify with Convert Experiences? 

This is possible, read more below...

Step 1: Convert Experiences Project Code

In Convert Experiences you need to take the project ID number from Project Settings as you see in the image below. 

Step 2: Add the Convert Experiences Code to Shopify

To have an integration between the two platforms, please go to Sales Channels > Online Store > Themes > More Actions > Edit Code

Select the theme.liquid layout and paste the tracking code, just before the first if section, as shown in the screenshot below:

Paste in the indicated area the code shown below. Make sure you replace the project ID number, that you took from the settings page and replace this entire text (including the brackets) <REPLACE THIS WITH PROJECT ID NUMBER>

See the Pen Shopify Integration - Step 2 - Shopify Tracking Code by George Crewe (@gcrewe) on CodePen.

Don't forget to save your changes in Shopify.

Step 3: Add the code to the Checkout Pages

We need to add the Convert Experiences tracking code to the checkout pages as well to be able to track conversions. For that, we will use the Checkout Settings where you can place additional scripts.

Go to Settings > Checkout and scroll down to the Additional scripts section. In the "Additional Scripts" form field paste the following code:

See the Pen Shopify Integration - Step 3 - Vanilla Simple Shopify Tracking Code by George Crewe (@gcrewe) on CodePen.

Replace the text, "XXXXX-XXXXX" with the Project ID found in your Project's Settings ( the same screen where you can find your Convert Experiences tracking code).

Here is an example of the complete script:

See the Pen Shopify Integration - Step 3 - Sample Shopify Tracking Code by George Crewe (@gcrewe) on CodePen.

Step 4: Allow the checkout page domain in your project settings

On Shopify, the checkout pages are presented under a central Shopify subdomain ( or your own domain, depending on the type of the Shopify account you have. In either situation (using your own or Shopify domain), you need to allow that domain in your project's settings. Add that specific domain to your project settings (see screenshots below):

Step 5: Forward tracking cookies to the checkout domain

If you are not using your own domain or if you are using a totally different domain than your main domain, for the checkout pages, you will need to manually forward the tracking cookies so that experiments fired on the shop pages can be connected later on to a conversion. To do that, on the cart page, where user leaves your main domain, you need to read the convert tracking cookies and forward them to the checkout domain as explained below.  

Go to Online Store > Themes > Current Theme > Actions > Edit Code  as explained in step 2). Open the "Sections" and select the "cart-template.liquid". Then, add the following JS script inside that file, just before the <form> tag:

See the Pen Shopify Integration - Transferring Cookies Script by George Crewe (@gcrewe) on CodePen.

Next, add the following inside the <form> tag:

See the Pen Shopify Integration - Step 5 onsubmit event by George Crewe (@gcrewe) on CodePen.

After this, you should be done. Now, the Convert Experiences cookies should now be forwarded to the checkout URL as two GET variables: _conv_v and _conv_s;

Note: if you use for checkout a subdomain of your main domain, then you do not have to do this step. Cookies will be saved under the root domain making them available on shop and checkout pages.

Step 6: Manual Revenue Tracking

If you do have not setup revenue tracking through Google Analytics, then please install the revenue tracking code under Settings > Checkout > Additional scripts:

See the Pen Shopify Integration - Manual Revenue Tracking by George Crewe (@gcrewe) on CodePen.

In the above code, XXXX is the goal ID to which the revenue is going to be attached and can be found in your Convert Experiences account. It is also automatically filled in the revenue tracking code you see when editing a revenue goal inside your Convert Experiences account.

Step 7: Verify your Shopify installation

You should verify your installation by following this guide:
Shopify Setup Verification Guide

Have more questions? Submit a request