Overview
The first step to using Wingify's features is to install the SmartCode on all the web pages where you plan to run your tests. The SmartCode allows your website to communicate with Wingify's servers. To learn about the working of Wingify SmartCode, refer to How Does Wingify SmartCode Work?
Things to Consider While Configuring SmartCode
- 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.
- If you want to test an iframe content on a page, then the Wingify's SmartCode should also be installed on the iframe URLs.
To check if you have correctly installed the SmartCode on your webpage, enter the URL in the SmartCode Checker. You can access the same by navigating from the main menu > Configurations > Websites and Apps > your domain > Check if SmartCode is installed properly on your URL section. See SmartCode Checker to understand what different results mean.
Ways to Add Wingify SmartCode
You can add Wingify SmartCode in two ways - Automatically or Manually. To add it automatically, Wingify provides third-party integrations. You need to download the Wingify plugins for specific third-party platforms.
To learn more about integrating Wingify with a third-party platform, refer to Extensions and Plugins in Wingify SmartCode.
Adding Wingify SmartCode Manually
You can add Wingify SmartCode to your website manually by performing the following steps:
- Navigate from the main menu > Configurations > Websites and Apps.
- Click on your domain under the Websites and Apps section. You can find your SmartCode under the Code tab.
- Wingify offers two types of code snippets: Asynchronous SmartCode and Synchronous SmartCode. By default, displays the Asynchronous version. To use the Synchronous, click the ⚙ icon at the top-right of the SmartCode section, select Synchronous, and click Save.
- Copy the SmartCode.
- If you need to consult a developer to add code to your website, click the share button to email the code snippet. A popup will appear with a pre-written email requesting that you 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.
The SmartCode installation is a one-time task. Once the code is in place, you can track your website visitor behavior or create as many website optimization campaigns as you like.
- For tracking on the Safari browser, go to Preferences > Privacy and disable the Prevent cross-site tracking setting.
- For tracking on the Firefox browser, go to Preferences > Privacy & Security > Custom and disable the following settings- Cookies and Tracking Content.
Adding SmartCode for Websites Using Rocket Loader
If Rocket Loader is enabled on your website, implementing the Wingify SmartCode the regular way could cause issues such as flickering. To keep it seamless for such cases, you would need to add an attribute to the script tag (<script type='text/javascript' id='vwoCode'>) in the SmartCode as shown below:
<script data-cfasync="false" type='text/javascript' id='vwoCode'>
Adding SmartCode for Next.js Websites
To integrate Wingify SmartCode with Next.js applications using the NPM package, refer to this document - https://www.npmjs.com/package/vwo-smartcode-nextjs.
Adding SmartCode for Nuxt Websites
If your website is built using the Nuxt framework, then to implement the Wingify SmartCode, perform the following steps in your code base:
- Open the nuxt.config file.
- Add the head configuration.
- In the link array of the head configuration, add { rel: 'preconnect', href: 'https://dev.visualwebsiteoptimizer.com' }.
- In the script array of the head configuration, add { type: 'text/javascript', id: 'vwoCode', innerHTML: `SMART-CODE-SCRIPT-CODE` }.
Adding SmartCode for Applications Using React Helmet
For applications using React Helmet, the process for adding the SmartCode is a little different. In an ideal React Helmet implementation, there would be no <head> tag in the codebase to insert the code. Instead, the tag <helmet> abstracts this.
Use brackets and back-ticks at the start and end of the SmartCode (as used in the above image). This is how the React Helmet expects third-party scripts to be added to the page. When this is compiled, the resulting page would have the usual <head> tag, and everything would work as expected.
If your privacy policy requires you to run Wingify code only after obtaining the visitor’s consent, read the Cookie Consent and Wingify’s Adherence article to learn about different approaches to implementing Wingify SmartCode.
Adding SmartCode for Websites Using Gatsby 4.19.0 and above
For websites using Gatsby versions 4.19.0 and above, perform the following steps:
- Create a component in your source code by inserting the script code from the SmartCode (excluding the script tag) into the _html key's value within the dangerouslySetInnerHTML attribute, surrounded by brackets and back-ticks, following the format demonstrated below:
- Now, copy the component and paste it into the file where you have your existing page components, as shown below:
Adding SmartCode for Websites Using Shopify Hydrogen
If your website is built with Shopify’s Hydrogen framework, you can add the Wingify SmartCode in two ways, specific to the framework's version.
For Shopify Hydrogen V1, perform the following steps:
- Locate the index.html file in the root directory of your Shopify Hydrogen project.
- Immediately under the <head> tag in the index.html file, paste the Wingify SmartCode (Async or Sync).
For Shopify Hydrogen V2, perform the following steps:
- Locate the app/root.jsx or app/root.tsx file in the root directory of your Shopify Hydrogen project.
- For Asynchronous SmartCode, inside the App function/class, just above the <head> tag, define a function that returns the Wingify SmartCode. To do that, you can paste the SmartCode without the script tags within the following code:
function getVWOAsyncScript() {
return {
__html: '<Paste SmartCode here>'
};
}
Now, at the start of the <head> tag, paste the following script tag:
<script type="text/javascript" id="vwoCode" dangerouslySetInnerHTML={getVWOAsyncScript()} />
Finally, your root file should look like this:
- For Synchronous SmartCode, inside the App function/class, at the start of the <head> tag, paste the following script tag:
<script src="https://dev.visualwebsiteoptimizer.com/lib/<Wingify Account ID>.js" id="vwoCode" />
It should look like this:
Need more help?
For more information or further assistance, contact Wingify Support.
Overview
The first step to using Wingify's features is to install the SmartCode on all the web pages where you plan to run your tests. The SmartCode allows your website to communicate with Wingify servers. To learn about the working of Wingify SmartCode, refer to How Does Wingify SmartCode Work?
Things to Consider While Configuring SmartCode
- 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.
- If you want to test an iframe content on a page, then the Wingify SmartCode should also be installed on the iframe URLs.
To check if you have correctly installed the SmartCode on your webpage, enter the URL in the SmartCode Checker. You can access the same by navigating from the main menu > Configurations > Websites and Apps > your domain > Check if SmartCode is installed properly on your URL section. See SmartCode Checker in Wingify to understand what different results mean.
Ways to Add Wingify SmartCode
You can add Wingify SmartCode in two ways - Automatically or Manually. To add it automatically, Wingify provides third-party integrations. You need to download the Wingify plugins for specific third-party platforms.
To learn more about integrating Wingify with a third-party platform, refer to Extensions and Plugins in Wingify SmartCode.
Adding Wingify SmartCode Manually
You can add Wingify SmartCode to your website manually by performing the following steps:
- Navigate from the main menu > Configurations > Websites and Apps.
- Click on your domain under the Websites and Apps section. You can find your SmartCode under the Code tab.
- Wingify offers two types of code snippets: Asynchronous SmartCode and Synchronous SmartCode. By default, displays the Asynchronous version. To use the Synchronous, click the ⚙ icon at the top-right of the SmartCode section, select Synchronous, and click Save.
- Copy the SmartCode.
- If you need to consult a developer to add code to your website, click the share button to email the code snippet. A popup will appear with a pre-written email requesting that you 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.
The SmartCode installation is a one-time task. Once the code is in place, you can track your website visitor behavior or create as many website optimization campaigns as you like.
- For tracking on the Safari browser, go to Preferences > Privacy and disable the Prevent cross-site tracking setting.
- For tracking on the Firefox browser, go to Preferences > Privacy & Security > Custom and disable the following settings- Cookies and Tracking Content.
Adding SmartCode for Websites Using Rocket Loader
If Rocket Loader is enabled on your website, implementing the Wingify SmartCode the regular way could cause issues such as flickering. To keep it seamless for such cases, you would need to add an attribute to the script tag (<script type='text/javascript') in the SmartCode as shown below:
<script data-cfasync="false" type='text/javascript'>
Adding SmartCode for Next.js Websites
To integrate Wingify SmartCode with Next.js applications using the NPM package, refer to this document - https://www.npmjs.com/package/wingify-smartcode-nextjs
Adding SmartCode for Nuxt Websites
If your website is built using the Nuxt framework, then to implement the Wingify SmartCode, perform the following steps in your code base:
- Open the nuxt.config file.
- Add the head configuration.
-
In the link array of the head configuration, add the following:
{ rel: 'preconnect', href: 'https://edge.wingify.net' }. -
In the script array of the head configuration, add the following:
{ type: 'text/javascript', innerHTML: `SMART-CODE-SCRIPT-CODE` }.
Adding SmartCode for Applications Using React Helmet
For applications using React Helmet, the process for adding the SmartCode is a little different. In an ideal React Helmet implementation, there would be no <head> tag in the codebase to insert the code. Instead, the tag <helmet> abstracts this.
Use brackets and back-ticks at the start and end of the SmartCode (as used in the above image). This is how the React Helmet expects third-party scripts to be added to the page. When this is compiled, the resulting page would have the usual <head> tag, and everything would work as expected.
Adding SmartCode for Websites Using Gatsby 4.19.0 and above
For websites using Gatsby versions 4.19.0 and above, perform the following steps:
-
Create a component in your source code by inserting the script code from the SmartCode (excluding the script tag) into the _html key's value within the dangerouslySetInnerHTML attribute, surrounded by brackets and back-ticks, following the format demonstrated below:
- Now, copy the component and paste it into the file where you have your existing page components, as shown below:
Adding SmartCode for Websites Using Shopify Hydrogen
If your website is built with Shopify’s Hydrogen framework, you can add the Wingify SmartCode in two ways, specific to the framework's version.
For Shopify Hydrogen V1, perform the following steps:
- Locate the index.html file in the root directory of your Shopify Hydrogen project.
- Immediately under the <head> tag in the index.html file, paste the Synchronous SmartCode.
For Shopify Hydrogen V2, perform the following steps:
- Locate the app/root.jsx or app/root.tsx file in the root directory of your Shopify Hydrogen project.
-
Inside the App function/class, at the start of the <head> tag, paste the For Synchronous SmartCode script.
Finally, your root file should look like this:
Need more help?
For further assistance or more information, contact Wingify Support.