With JavaScript files hosted on your server, your website doesn't need to contact a VWO server for loading test variations.
Why Self-host the Test Files?
As a website owner, you may be skeptical about using external JavaScript from a third party. For your requirements, you may want to remove the dependency on VWO servers and have all the test resources under your control. Using the self-hosting option, you can store the VWO JavaScript files locally to ensure that the test settings, files, and code for your tests reside on your server.
For such self-hosting websites, the VWO servers only register visits and conversions. Typically, self-hosting is more relevant if VWO Content Delivery Network (CDN) does not have a node in or near your country.
How to Host VWO JavaScript Files On Your Server
- Log in to your VWO account.
- Go to TEST and create a test(A/B, Multivariate, or Split URL).
- In the OTHERS page of test creation, click Advanced Options > Host JavaScript code on my server. Enabling this option ensures that the files to be hosted are created when you finish creating the test.
- To download the files that you need to host, click CREATE. If you have enabled the self-hosting option, the following files appear on the Campaign Created Successfully page:
a. vwo_static.js
b. vwo_test_1.js, where the number denotes the number of tests
This file is unique for each test you create. You must download the file for every test you want to host on your server.
- Before starting the test, upload the files to your server.
- Download the same files again and upload them to servers every time you update the test.
Few things to Consider
- The Geo-targeting functionality will not work if you have opted to self-host your test files. Self-hosted files do not interact with VWO servers, and therefore geo-targeting the test will not be possible.
- You cannot run a test across multiple domains if you have opted to self-host your test files.
- The self-hosting test files option is supported only for the VWO test. Insights (including Analyze and Track) functionalities are not supported.
- You cannot set up or use a Custom URL when you are self-hosting the test files.
- The live previews option does not work for tests where self-hosting is enabled.
Enabling Self-Hosting Option for an Existing Test
For an existing test, you can enable the option from the View/Edit Test Details section of your test details page. If you are self-hosting the test files on your own server, you must note that the Adhere to Do Not Track feature does not apply.
Hosting JavaScript Files for Multiple Tests on a Single Page
If you are running multiple tests on a single page, download the test-specific files (vwo_test_YourCampaignID.js) for each test and upload them to your server. However, you do not need to upload the common VWO script (vwo_static.js or vwo_no_jquery.js) for each test. This script work for all your tests.