Some common usage for Campaign or Global JS code in VWO include:
- Sending VWO campaign data to analytics tools
- Custom conversion goal tracking (using pre-campaign JS)
- Define a JS function to capture the variation served to a visitor and then trigger the respective variation of a survey/notification widget
To add campaign-level JS/CSS, click Campaign JS/CSS on the upper-right side of the editor.
This is the default mode when you select the Campaign JS/CSS option. Here, you can define JS code that you want VWO to execute after the campaign code executes on the page.
To add post-campaign JS, click the Settings icon next to Variation1 and then click Edit Code or click </> on VWO Visual Editor.
Note: Post-campaign JS will run only on the URLs which are included in Settings > URLs section in the test.
To add custom CSS to the website, select CSS > Include External Stylesheet.
Enter the URL to the CSS you want to include. To use some commonly known CSS libraries, select an option from the Quick Add list and then click Done.
Add your pre-campaign JS code on the right panel of the window. On the left panel, enter the global/post-campaign JS code you want to execute after applying changes.
To apply the changes, click Done.
Note: Pre-campaign JS executes on the URLs defined in the test and any goal URLs included in the test.