The first step to use the functionality offered by VWO is to install the Smartcode in all the web pages where you want to run your tests. The Smartcode enables your website to interact with VWO servers. To learn more about VWO Smartcode, refer to How does VWO SmartCode Work?
Things to Consider
- If Iframe URLs are on the page, the VWO smartcode should also be installed on the Iframe URL.
- If your website uses template-based headers and footers, add the code snippet in the header to implement it across the website.
- The Smartcode must be placed before the </head> tag of your website. Adding the code snippet in the head of a webpage helps execute the code faster and doesn't slow down the rest of your page from loading.
How to Add VWO Smartcode?
You can add VWO Smartcode in two ways- Automatically and Manually. To add the Smartcode automatically, VWO provides third-party integrations. You can add the VWO Smartcode by installing VWO plug-ins for some third-party platforms. To learn more about how to integrate VWO with a third-party platform, refer to Extensions and Plugins in VWO Smartcode.
Adding VWO Smartcode Manually
After you have added the code to your website, the code does not change for any test. With the code in place, you can create as many website optimization tests as you want.
- Log in to your VWO account.
- Go to SETTINGS > SMARTCODE.
- Choose the type of Smartcode you want to work with.
INFO: VWO provides two different types of code snippets: Asynchronous
Smartcode and Synchronous Smartcode.
- Copy the Smartcode.
- If you need to consult a technician to add code to your website, click Send to Developer to email the code snippet.
A dialog opens up having a pre-written email requesting to add the Smartcode to your website.
- To do it yourself, sign in to your website admin panel and paste the Smartcode snippet between the <head> and </head> tags of the page.
Post-requisite: To verify whether the Smartcode is successfully added on your webpage, enter your webpage URL in the Verify if VWO Smartcode is installed on the URL field under the SMARTCODE CHECKER section present in SETTINGS > SMARTCODE.
ATTENTION: You should not install VWO code through tag managers such as
Google Tag Manager. By default, all the tag managers load VWO code
asynchronously, which may cause page flicker on the test pages. Also,
using tag managers may lead to delayed loading of the VWO code, which can
cause time-out issues and prevent visitors from becoming part of the test.
For The React-helmet Case
NOTE: Use brackets and back-ticks at the start and end of the Smartcode
(as used in the above image). This is how helmet expects the addition of
third-party scripts to the page. When this is compiled, the resulting page
would have the usual <head> tag and everything would work as expected.