To run a split URL test across your website, use the URL matches pattern option to define the set of URLs you want to include in the campaign. For example, if you are testing different themes, sidebar location, placement of ads, and so on, define the URL pattern for both control and variation, using the wildcard * (an asterisk) to match a part of the URL.
For example, if a user lands on http://www.example.com/test/index.html, then Variation URL after redirection would be http://www.example.com/b/test/index.html.
Ensure that each control URL has a corresponding variation URL. VWO does not capture the data if there are no corresponding URLs or if the page throws the 404 error. Also, make sure that VWO SmartCode is added to every page where you want to run the split URL test.
Setting Up Negative Regex
To run your VWO test on specific pages, you can create a negative regex and add in the Exclude URLs section. For example, let us say you want to run the test specifically for 4 pages in the product section of your website – shoes, bags, dresses, and home. To set up a negative regex for the test, enter the URL details as follows:
CONTROL:
URL matches pattern
http://www.test.com/product/*
VARIATION:
URL matches pattern
http://www2.test.com/product/*
EXCLUDED URLs:
URL matches Regex
(.*com/product)(?!\/(shoe|bag|dress|house)).*
The negative regex will make sure that the test will run only on the specified pages.
Setting Up Custom URLs
Custom URLs are used to run VWO tests on multiple pages of a website when it does not have a consistent pattern in the URLs. For example, consider an eCommerce website that has several independent URLs for category or product pages without any defined pattern, like http://example.com/adidas/, http://example.com/reebok/, http://example.com/microsoft/, http://example.com/adobe/, and you want to run the test on only on shoe pages (the first two URLs).
You can use the Custom URL option to define an imaginary custom URL as an identifier for the pages you want to test, even if the URL may not exist.
For example, if a user wants to run a split URL campaign on a few URLs such as:
CONTROL:
http://www.example.com/adidas/
http://www.example.com/reebok/
VARIATION:
http://www.example.com/adidas?camp=vwo
http://www.example.com/reebok?camp=vwo
The imaginary URL “_vis_opt_url” can be set as below for all the Control URLs:
Now, the URL setup in VWO would be as follows:
- Control (as per the imaginary URL added in code): http://www.example.com/test*
- Variation: http://www.example.com/*?camp=vwo
In case of a split URL, a custom URL campaign needs to be set up, per the requirement and URL structure of the test website. Therefore, feel free to reach out to support@vwo.com if you need any help in building a custom URL for your requirement.
Modify VWO Asynchronous code to implement custom URL
For tests using VWO asynchronous code, make the following changes to the asynchronous code snippet and add custom URL to the _vis_opt_url variable:
- Just before the window._vwo_code = window._vwo_code || (function() add the following code snippet:
var _vis_opt_url=document.location.protocol + '//' + document.location.hostname
+ "/test" + document.location.pathname + document.location.search + document
.location.hash; - Note that this value will change according to your use case.
- After the accountId, add _vis_opt_url = window._vis_opt_url || document.URL
- Replace encodeURIComponent(d.URL) with encodeURIComponent(_vis_opt_url)
Modify VWO Synchronous code to implement custom URL
For tests using VWO synchronous SmartCode, you can modify the code snippet to add the custom URL to the _vis_opt_url variable as follows:
<script type="text/javascript">
// Only on pages where this test is to be run
var _vis_opt_url = document.location.protocol + '//' + document.location.hostname + "/test" + document.location.pathname + document.location.search + document.location.hash………
// Common VWO Code
var _vis_opt_url = typeof(_vis_opt_url) == "undefined" ? document.URL : _vis_opt_url;….
'&url=' + encodeURIComponent(_vis_opt_url) + '&random=' + Math.random()…