• Skip to primary navigation
  • Skip to main content
Integral Parts

Integral Parts

Your partner for online business growth

  • Home
  • What We Do
    • Analytics & Optimization
    • Custom Development
    • Search Engine Optimization
    • Search Engine Marketing
  • About Us
    • Careers
  • Blog
  • Contact Us

Conversion Rate Optimization

A/B Testing Shopify Themes in VWO

integralparts · June 16, 2020 · Leave a Comment

If you need to test out a lot of changes at once with a Shopify store, split testing themes is the likely easiest way to go about it. Modifying code manually through the editing tools built into your testing tools can be very difficult or altogether impossible.

But, that isn’t to say that running two Shopify themes at once doesn’t come without its fair share of challenges. Due to the way that Shopify handles live and preview themes, a number of different things need to be put in place to allow for a good experience. Let’s break down the steps for testing two themes in VWO (Visual Website Optimizer) by Wingify.

Hide Preview Bar

Assuming you already have two (or more) themes you’re ready to test, the first things you’re going to want to do is hide the Shopify preview bar by adding a bit of CSS to theme’s CSS file or as near to the top of the <head> as possible.

.shopify-preview-bar { display: none }

This will prevent the bar at the bottom of the page from displaying, certainly something you don’t want your test participants to see.

You’ll also want to ensure that the pesky preview bar doesn’t show in the checkout, which requires an extra bit of code to be inserted into the Shopify Admin, under “Online Store > Preferences” in the Google Analytics – Additional Google Analytics JavaScript input box. If you already have code here, just add this to the end exactly as you see below.

(function() {
 var css_override = document.createElement("style");
 document.getElementsByTagName("head")[0].appendChild(css_override);
 })();

var css = 'iframe#preview-bar-iframe { display: none !important; }', 
head = document.head || document.getElementsByTagName('head')[0], 
style = document.createElement('style'); 
style.type = 'text/css';

if (style.styleSheet) { 
 style.styleSheet.cssText = css; 
} else { 
 style.appendChild(document.createTextNode(css)); 
} 
head.appendChild(style);

Now, save it and head back to your preview theme, start a checkout and confirm the preview bar is no longer there.

Modify VWO Code

The standard VWO code works great, but it has a tough time dealing with the redirects that happen when previewing themes in Shopify. If you’ve ever noticed, when previewing a theme, the URL will change after the preview is triggered.

For example, https://www.example.com/?fts=0&preview_theme_id=40229273666 becomes https://www.example.com/?fts=0 when the page is fully loaded, and the new theme is visible.

Due to the way VWO evaluates test URLs, we need to make a few changes. The code below can be used to replace the currently implemented VWO code, just update the [XXXXXXXXXXXX] with your preview theme ID and VWO account ID to make it your own.

  <!-- Start VWO Asynchronous Code -->
  <script type='text/javascript'>
    _vis_opt_url = document.location.protocol + '//' + document.location.hostname + document.location.pathname + "?preview_theme_id=[XXXXXXXXXXXX]&" + document.location.search.substring(1,) + document.location.hash    
    var _vwo_code=(function(){
      var account_id=[XXXXXXXXXXXX],
          _vis_opt_url = window._vis_opt_url || document.URL,
          settings_tolerance=2000,
          library_tolerance=2500,
          use_existing_jquery=false,
          /* DO NOT EDIT BELOW THIS LINE */
          f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(_vis_opt_url)+'&r='+Math.random());return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
  </script>
  <!-- End VWO Asynchronous Code --> 

Save these changes in both your current theme and your test theme in Shopify. You’ll also need to update this code in your conversion tracking scripts as well so that conversions continue to flow through correctly.

Add it to your “Additional Scripts” section in your checkout settings in Shopify along with the conversion tracking code below.

{% if first_time_accessed %}
<script type="text/javascript">
	window.VWO = window.VWO || [];
	window.VWO.push(['track.revenueConversion',"{{ total_price | money_without_currency }}"]);
</script>
{% endif %}

Setup The VWO Test

The next step you’ll need to complete is the setup of the VWO test.

There are a lot of settings we’re not going to cover here, such as traffic splits, integrations, or goal setup, but for this test to work, it is important to make sure the test is set up as a split URL and not a normal A/B test.

When setting up your split test you’ll want to make sure you use “URL matches pattern” for your selection for both control and variation URLs. This will ensure that your test runs for all pages, not just a single page.

The control URL will be easy, just use your regular URL – minus the trailing forward-slash ( / ) and add the wildcard character ( * ) at the end.

https://www.example.com*

Your variant URL will depend on your specific preview theme URL, but will look similar to the above with the ID added to the end and an extra parameter, like “test=1”.

https://www.example.com*?preview_theme_id=40229273666&test=1

The “test=1” will be used in the last setup step, to exclude some URLs from the campaign, which will prevent an endless redirect loop from happening.

Make sure to check the box below “More Options” to “exclude some URLs” containing the “test=1”.

This screenshot shows the setup in the current VWO interface.

Preview Your Tests

Save your changes, then preview your control and variant using the live preview functionality built into VWO.

You’ll want to copy/paste the links into a new, incognito browser session to make sure you remove any cached variables or active previews from Shopify or VWO.

If you have any questions, feel free to comment below

5 reasons why you should be testing your website

integralparts · August 3, 2016 · Leave a Comment

Have you ever wondered if your website could be converting more of your visitors into buyers or capturing more leads? Chances are if you’re not already testing your website’s design, content, or user flows, it could be doing more for your business. Testing and optimizing your website can help your business grow by converting more of your current traffic into customers.

Here are five reasons why you should start testing your website:

  1. It helps to eliminate the biases and “best practices” that contributed to the design of your current website.
    Often, our likes, preferences, and feelings (or those of others) become part of the website design process. I bet there’s a good chance that your website was at least partially created based on what you or your head of marketing likes, not what your users want. A/B testing allows you to test all of this and figure out what works best for your visitors.
  2. The incremental gains from testing add up over time.
    A 5% increase in conversion rates on your ecommerce site might not seem like a big win at first, but over time, those little 5% increases begin to accumulate and make any future traffic efforts more worthwhile. Sending visitors to an unoptimized website is like trying to fill up a bucket with many holes.
  3. It allows you to see how your visitors act in real world situations.
    A/B testing on a live website allows us to test directly with real-world visitors. It’s one thing to hear from your visitors through surveys about how they might act in a hypothetical situation, but you’re able to learn much more by observing real actions.
  4. You can test your marketing messaging to find out what resonates best with your visitors.
    The content and messaging used throughout your website should be helping to tell your story and to sell your product. If your current content isn’t connecting with visitors, how would you know and how would you know what works? A/B testing allows you to hone your content so that it connects with your visitors and is as effective as it can be.
  5. It allows you to succeed or fail quickly.
    If your current website isn’t converting like you think it should be, it’s easy to test out new ideas to see if it has a positive impact on your website visitors. Instead of waiting and wondering if your current site could be better, test it. A/B testing allows you to quickly validate new ideas or theories and iteratively improve your online experience.

Driving more visitors to your website through paid advertisements can be costly, and sending these visitors to a website that isn’t performing at its peak is a waste of money. A/B testing allows you to iteratively refine your website to get more conversions out of the traffic you already have.

Getting started with A/B testing is easy and relatively affordable. And, almost anything on your website that has an effect on visitor behavior can be A/B tested.

So, what can you start testing? Here are a few ideas to help get you started:

  • Headlines
  • Sub headlines
  • Paragraph text
  • Call to Action text and styles
  • Link styles and wording
  • Images
  • Content near the fold
  • Social proof
  • Media mentions
  • Awards and badges

Ready to start a partnership? Contact Us

Integral Parts

Copyright © 2025

  • contact@integralparts.com
  • Privacy Policy