ATTENTION: Before you configure the Dynamic Text in VWO editor, ensure
that the variables used in the operations are present on the page
before the campaign gets executed. To learn how to configure Dynamic
Text for your test campaigns in VWO, refer to Configuring Dynamic
Text for Your VWO Campaigns.
Here is the list of variables that VWO supports for Dynamic Text:
Predefined variables are the ones that are provided by VWO. You can use these predefined variables directly without declaring them in your campaigns. These variable are:
- URL of the website. For example, https://abc.com/index.htm
- The domain of the website. For example, abc.com
- The browser language
- The current date in YYYY/MM/DD format
- Current time in HH:MM format
- The device type with which visitor is accessing the website (mobile/tablet/desktop)
Other standard variables
Apart from the website variables mentioned in the previous section, you can use any global variable present in the window, such as- window height, window width, etc. To learn about more such variables, refer to this article.
In VWO, you can use all variables of the browser window object. These are available for any website that the browser opens and is not specific to a particular website.
A website can have its own set of variables based on which you can customize your visitor’s experience. These variables are unique to the website and are not standard.
To use variables that are not covered under the Pre-defined Variables list, you can declare them or insert them in the EJS syntax directly in the text or HTML of the element. During the campaign’s run time, VWO will automatically fetch these values to use them.
NOTE: VWO does not create a new variable; it simply uses the ones
present in the window.
For example, to get the status of whether a user has completed onboarding (with the key- ‘onboardingComplete from the local storage), you can use a script like the one that follows:
NOTE: Only synchronous functions are supported and the function must
return a value.