Your browser is out of date. The site might not be displayed correctly. Please update your browser.

Knowledge Base
Extra Tools
PageImprove
How to install JS snippet

How to install JS snippet

PageImprove uses the JavaScript code snippet to apply changes to the page content. Please read below to learn how to install the JS snippet correctly.

Check out Notes on interaction with client-side A/B testing tools to learn about PageImprove compatibility with other A/B testing tools.

Where to put the code snippet on the page

The <head> tag is the best place to put the snippet on the page. The earlier the script is loaded, the faster it will be able to make the changes to the page.

PageImprove JS snippet already uses techniques like resource hints  to load the code even faster and to minimize the probability of the page flickering.

Integration via tag manager

It is possible to install the code snippet via a tag management solution like Google Tag Manager, but this will delay initialization, potentially harming the bot and user experience. We recommend using integration via tag managers only to test how PageImprove works. To maximize the bot and user experience, we recommend installing the JS snippet directly to the <head> tag.

Async support

The JS snippet can be loaded asynchronously using the “async” attribute.

Compatibility with JavaScript frameworks (e.g., React, Angular, VueJS)

For now, we do not recommend using PageImprove on websites based on frameworks like React, Angular, or VueJS. This is because these frameworks manage the state of the website themselves, and PageImprove might conflict with them.

However, it might work to change metadata if the JS framework does not control it. Please consult with the developers of the particular website for more information.

Any questions? Just drop us a line at pageimprove-feedback@semrush.com