VWO Code Editor is an advanced VWO feature for users who want to code the changes on their website. Code Editor allows you to modify the code of native VWO operations according to your needs and add your custom code to the tool. To learn more about JS code snippets for VWO operations, click here.
Using the Code Editor, you can modify variation code directly or add external JS/CSS to a variation or even modify code at the test level.
Accessing Code Editor
Modifying code in a variation
Adding JS/CSS for the test
Accessing Code Editor
If you are an advanced user and want to use code-editor to write custom variations code instead of the Visual Editor, select the Open in Code-only Mode option on the first screen (Campaign URLs) page of your test creation process. Please note that the variations created through this mode will not be editable through the Visual Editor and vice-versa.
Alternately, you can switch to a code-only editor by clicking the Edit Code (</>) on the lower-left side of the visual editor.
Modifying Code in a Variation
To modify the code snippet of a variation, click the Edit Code option on Variation Settings.
Adding JS/CSS for the Test
Using VWO Code Editor, you can also add the test level JS/CSS to execute before or after applying the variation changes. Test JS/CSS is the code that will run across your website, including all variations and the control. You would add global JS/CSS when you want to implement a change across all your test pages, including the control.
Click Campaign JS/CSS on the lower-right side of the editor.
To learn more about adding test JS/CSS, refer to How to Add Pre/Post-Campaign JS/CSS.
If you wish to build changes on your webpage using custom code from any component you may be using for your website, use the Edit Code > HTML section of the VWO Editor. This provides you with a blank canvas where you can add your code.
If you wish to build changes on your website by adding components by their custom code, use the Edit code > HTML section of the VWO Editor. You can code from scratch or quickly re-use any website component that is already developed.
For instance, if you wish to use the code of a banner or pop-up widget you used for a previous campaign, all you need to do is- Grab its HTML and add it to the page. You can now modify and reposition the contents based on your requirements—all this within VWO’s Editor.
To learn about some testing ideas which can be implemented easily using custom HTML on the web page, refer to this product update.
Some Additional Settings
Some settings that you can use while working with the Code Editor in VWO.
- Code Linting: Linting is the automated checking of your source code for programmatic and stylistic errors. This is done by using a lint tool (otherwise known as linter). A lint tool is a basic static code analyzer.
- Show code suggestions: It helps you complete the names of classes, methods, fields, and keywords within the visibility scope. This helps you speed up your coding and reduce the keyboard input time using.
- Code Wrapping: It allows you to wrap the long lines of code within the editor. This brings in better readability.