The code editor is a powerful tool for users to implement changes on test variations using code. Using the editor, you can edit the variations by directly editing JS/CSS of the webpage and also import custom libraries or a standard library using the quick add option.
-
Adding Custom JavaScript
-
Importing External CSS
Adding Custom JavaScript
-
To add JavaScript code, select the variation you want to edit and then click Edit Code on VWO Visual Editor.
-
To add your own JS library, select JavaScript > Include External JavaScript under Campaign JS/CSS.
-
To import custom JavaScript, go to Settings and click Include External JavaScript. Then, type the file path to your custom JS and then click DONE.
-
There are some common Javascript libraries included in the Quick Add drop-down. You could select one and then click DONE. By default, VWO automatically includes the jQuery adding the custom JavaScript code snippet.
-
The JavaScript code snippet for the selected library is included in the variation, as displayed in the following screenshot. Make your modifications to the library and then click DONE.
Importing External CSS
-
To add your custom stylesheet into the variation, select CSS > Include External Stylesheet.
-
To import the stylesheet, enter the file path to your custom CSS.
-
To use some commonly known CSS libraries, select one from the Quick Add list and then click DONE.