How to Test on Sites That Change the Page After It Loads
Keep variations from disappearing on React, Next.js and Shopify sites, and build them when the Visual Editor hides content or needs a login.
What you can do after reading this article
- Find out which case you have
- Fix changes that disappear after the page loads (React, Next.js)
- Fix sections that a Shopify theme removes
- Build a variation when the Visual Editor hides part of the page
- Build a variation on pages behind a login
- Check your variation before you launch
Find Out Which Case You Have
Some websites change the page after it loads. In Convert Experiences, the tracking script applies your variation while the page loads, and it handles most later changes on its own. Its SPA optimizations are on by default in every Web project. When your site redraws an element that a variation changed, the script applies the change again. When your site removes an element or a style that a variation added, the script puts it back. See SPA Optimizations.
This article covers the cases where that isn't enough, and the cases where you can't build the variation in the Visual Editor at all.
Start with one test. Open the variation's Preview. It loads your page in a normal browser tab, outside the Visual Editor. Then match what you see:
| What you see | Go to |
|---|---|
| In Preview or on your live site, the change shows, then the original comes back. It often happens as the page finishes loading. | Fix changes that disappear after the page loads |
| On a Shopify store, a section or text you added shows, then disappears. | Fix sections that a Shopify theme removes |
| The page looks right in a normal tab, but part of it, such as the header menu, is missing in the Visual Editor. | Build a variation when the Visual Editor hides part of the page |
| The Visual Editor shows your login page, keeps reloading, or shows the page as a signed-out visitor sees it. | Build a variation on pages behind a login |
The first two cases happen on your live site, so visitors are affected. The last two only affect the Visual Editor. Visitors see your page normally.
📒Note: The Visual Editor has a setting called Enable SPA Mode. It helps the editor select elements on pages that redraw themselves, so it can help while you build a variation. It doesn't change what visitors see, so it doesn't stop a change from disappearing on your live site. It's on by default, and the editor saves it in your browser. See How to Enable SPA Mode in the Convert Visual Editor.
Fix Changes That Disappear After the Page Loads
This mostly happens on sites built with React, Next.js, Vue, Nuxt or Angular. Either the server sends a finished page and the app's JavaScript then takes it over in the browser (this is called hydration), or the app draws the page in the browser itself. Either way, the app can redraw parts of the page and undo your change.
To install Convert on these sites, see Enhancing Your React Application with Convert A/B Testing (React and Next.js) and Installing Convert Experiences on a Vue.js app.
How to recognise it
- In Preview or on your live site, the change shows for a moment, then the original content comes back.
- The change shows in the Visual Editor, but not in Preview.
- The experience did start. On the page, open your browser's console and type
convert.currentData.experiences. If your experience is listed but you don't see the change, the experience started and the change didn't stay on the page.
What to do
Work through these steps in order. Preview again after each one.
1. Check that SPA optimizations are on.
- Open your project and go to Configuration > More Settings. Disable Single Page App Optimizations must be unchecked.
- Check the address of the page you test. If it contains
_conv_disable_spa_optimizations=true, SPA optimizations are off for that page view. - If Use Legacy Script shows under Configuration > Environments & Tracking Code, your project still runs the legacy tracking script, which is deprecated. Follow Migrate from the Legacy Tracking Script to the New Tracking Script (Step-by-Step) first.
2. Make the selector match the redrawn element.
The script finds the element to change with a CSS selector. When your app redraws the element, the script applies the change again only if the selector still matches the new element. Long paths, selectors based on an element's position, and class names your build generates often stop matching. Generated class names can also change every time your site is deployed.
- In the Visual Editor, open the change from the list on the left. Next to Selector, click the pencil icon (Click to edit element selector).
- In Edit element selector, enter a short selector based on a stable id, class or attribute, for example
#hero-titleor[data-testid="hero-title"]. - The dialog shows how many elements match. You want 1 matching element found. Click Save Selector.
- Check the selector on your live page too. Wait until the page has fully loaded, open the console and type
document.querySelectorAll("#hero-title").lengthwith your selector. You want1.
To stop the editor from choosing generated class names in the first place, click Settings > Element Selection Settings in the Visual Editor. Add the parts of those names that repeat, one per line, for example css-, and click Save Changes. The editor then ignores classes and ids that contain them when you select an element. Changes you already made keep their selectors, so edit those as above. See Element Selection Settings.
3. Use Variation CSS for style changes.
Colors, sizes, spacing and hiding an element can all be done with CSS. In the Visual Editor, click the code icon at the top (Click to open JS/CSS code editors) and add your rules on the Variation CSS tab. A CSS rule applies to the element every time your app redraws it. If your app removes the style from the page, the script adds it back. If your site's own styles win, add !important to your rule. See Convert's Code Editors explained.
4. Start the experience after the page has loaded.
If the change still disappears, let your app finish before the experience starts. You do this with a location trigger.
- Open your project and click the Locations tab. Click the location your experience uses.
- On the Advanced tab, under Triggers, choose When a callback is called.

- Paste this code into the Callback JavaScript box and save the location.
if (options.isActive) return;
function start() {
// Short pause after the page has loaded. Raise it if your app is slower.
setTimeout(activate, 500);
}
if (document.readyState === "complete") {
start();
} else {
window.addEventListener("load", start, { once: true });
}
activatestarts the experience. Convert still checks the location's conditions first.- The script runs this code again after each route change, so the experience still starts when a visitor moves around your app.
- If your app adds a specific element only once it has loaded, wait for that element instead. See Targeting Experiments with Dynamic Location Triggers (JS Callbacks).
- The trigger applies to every experience that uses this location. If other experiences share it, create a new location for this experience.
- Which triggers you can choose depends on your plan. See Use a Location Trigger.
⚠️ Important: When the experience waits for the page, visitors see the original content until the change appears, on every page view and after every route change. Keep the wait as short as your app allows, and try steps 2 and 3 first.
When to bring in a developer
- Your variation uses Variation JS. The script re-applies changes made with the Visual Editor, but it doesn't follow what code on the Variation JS tab does. The script doesn't re-apply Variation JS when your app redraws an element, but the code can run again after a route change. Your developer can make the code wait for the element, run it again when the app redraws it, and guard against applying it twice. See SPA support in the developer docs.
- The change depends on your app's data or behaviour, not only on how the page looks. Build the variation into the app instead. Your developer can add both versions to the app and switch between them with Variation CSS, as in Build both versions into your theme. To decide variations in your own code, use a Full Stack project. See Test on Your Server or in a Native Mobile App and Which Convert Product Should I Use?
- The page gets slow or links stop working once the change is applied. See Advanced SPA Configuration: Tracking Script Optimization Tips.
If a change appears on the first page but not after the visitor moves to another route, or stays after they move on, see Single Page Application (SPA) Troubleshooting Guide.
Fix Sections That a Shopify Theme Removes
Many Shopify themes update parts of the page with their own JavaScript, for example when a shopper picks a product option, opens the cart or filters a collection. Apps installed on your store can do the same. When the theme redraws a section, it can remove a section or text that your variation added.
How to recognise it
- In Preview, a section or text you added shows, then disappears when the page finishes loading or after you use the page.
- When you reload the page, the change comes back, then disappears again at the same step.
What to do
1. Run the same checks as for any site. Make sure SPA optimizations are on and the change's selector is short and stable. Avoid ids and classes that contain long generated numbers. See steps 1 and 2 in Fix changes that disappear after the page loads.
2. Use Variation CSS for style changes and to hide sections. CSS rules keep applying when the theme redraws a section. See step 3 in Fix changes that disappear after the page loads.
3. Build both versions into your theme. For new content, ask whoever edits your theme to add the new section to the theme, hidden by default. The variation then only has to show it with Variation CSS. Because the section is part of the theme, the theme's scripts keep it, and the CSS keeps applying when the section is redrawn. For example:
In your theme's CSS, hide the new section for everyone:
.new-banner {
display: none;
}
In the variation's Variation CSS tab, show it and hide the old one:
.new-banner {
display: block !important;
}
.old-banner {
display: none !important;
}
Change .new-banner and .old-banner to the classes of your own sections. If the new section is laid out with flex or grid, use that display value instead of block. Hide the new section with your theme's CSS, not with a style attribute on the section itself, so the variation can show it.
4. Test a whole theme or template. For bigger changes, make them in a copy of your theme in Shopify's theme editor. Then test that theme against your live theme with Theme Rules in the Convert Shopify app. The theme copy needs the Convert tracking code installed, and Theme Rules only list Active experiences, so start the experience first, with a QA audience while you check it. See A/B Test Shopify Theme Designs. To test a different template for one page type, such as product pages, see Split Test Shopify Templates Using Convert.
When to bring in a developer
- The new content has to work with the cart or product options, for example a button that adds to cart. Build it into the theme as in step 3 or 4.
- The change has to come back after a specific step, such as opening the cart. Your developer can run the variation's code again when the theme redraws that section.
To install Convert on your store, see Integrate with Shopify through our Shopify Convert App.
Build a Variation When the Visual Editor Hides Part of the Page
The Visual Editor loads your page inside a frame (an iframe) on app.convert.com. Some sites check whether they're inside a frame and then hide parts of the page, such as the header menu, or block the whole page. Sites do this to protect themselves from other sites that frame them. It only affects the editor. Your visitors and your Preview see the page normally.
How to recognise it
- Part of the page is missing or empty in the Visual Editor, but shows when you open the same page in a normal tab. To compare, click the icon at the top of the editor with the tooltip Click to open edited website in a new tab.
- To confirm, load your page inside a frame outside Convert. Visual Editor Troubleshooting: Iframe Compatibility shows how. If the same part disappears there, your site hides it in frames.
What to do
1. Turn on Convert Experience Tools. Install our Chrome extension, turn it on and add your domain to it, then reload the Visual Editor. The extension removes security headers that stop sites from loading in a frame. If your site's own JavaScript hides the content, the extension may not help. See Chrome Debugger Extension For Convert Experiences.
2. Select the hidden element by its selector. If the element is still in the page but hidden, you can change it without clicking it:
- In a normal tab, find the hidden element's selector with your browser's developer tools.
- In the Visual Editor, click a visible element near it. Next to Selector, click the pencil icon and enter the hidden element's selector.
- If the dialog shows 1 matching element found, the element is there. Click Save Selector and make your change.
You won't see the change in the editor, so check it in Preview.
3. Write the change in the code editors. Click the code icon at the top of the Visual Editor (Click to open JS/CSS code editors) and add your change on the Variation CSS or Variation JS tab, using selectors you found in a normal tab. Then check it in Preview, which opens your page in a normal tab, not inside the editor.
When to bring in a developer
Ask your developer to stop hiding content when the page is loaded by the Convert Visual Editor on app.convert.com. If you'd rather keep the protection on your live site, they can turn it off on a staging copy of your site, and you can build the variation there. Convert can't change this behaviour from our side.
Build a Variation on Pages Behind a Login
The Visual Editor loads your page in your own browser when it can connect to the page. It connects through the Convert tracking code on the page, or through the Convert Experience Tools extension when you have it on. If neither connects in time (8 seconds by default, see Page Load Timeout Settings), the editor loads the page through Convert's proxy instead, however fast the page is. The proxy fetches the page from Convert's servers, so it doesn't use your browser's signed-in session.
How to recognise it
- The Visual Editor shows your login page, keeps reloading or redirecting, or shows the page as a signed-out visitor sees it, for example with an empty cart.
- A bar at the top of the editor says Convert snippet not detected on your site. Some features may be limited due to missing code or site restrictions. Install our Chrome extension and add your domain to restore full functionality. The editor loaded the page through the proxy.
What to do
If your browser asks for a username and password in a pop-up (HTTP Basic Authentication, common on staging sites), click Settings > HTTP Basic Authentication settings in the Visual Editor. Enter the Username and Password and click Save. See Can I Test a Protected Site?
If your site has its own login page:
- Install the tracking code on the pages behind the login too, not only on your public pages. Convert's installation check can't check those pages, because it visits them as a signed-out visitor. Use I've installed it, mark as installed instead. See Tracking Script Installation Verification.
- Install Convert Experience Tools, turn it on and add your domain. Besides removing headers that block frames, it adjusts your site's SameSite cookies for the domains you add. See Chrome Debugger Extension For Convert Experiences.
- Sign in to your site in another tab of the same browser, then reload the Visual Editor. In Chrome with the Convert Experience Tools extension on, the editor can then use the same signed-in session, as long as your browser doesn't block third-party cookies (see Third Party Cookie blocking). Safari and Firefox block those cookies, so the session usually doesn't carry over there. See Page loaded through proxy inside the Visual Editor.
- If the editor still shows you as signed out, try signing in inside the editor. Click the Browse Mode icon at the top of the editor, sign in, go to the page you want to edit, then click the icon again to go back to editing. This only works if your login page works inside the editor. See Use Browse Mode.
If you still can't load the page:
- Build on a similar page without a login. Click Settings > Change Editor Page (not offered for multipage experiences) and load a page with the same layout, such as a staging copy. The page you edit doesn't change where the experience runs, so keep the experience's location on your real pages. Check that the change's selectors also match on the real page. See Change Page in Editor.
- Write the change in the code editors and check it with Preview. Preview opens your page in a normal tab of your browser, where you're signed in. If signing in removes the preview details from the page address, use the QA Overlay link instead. Its session stays with you as you move between pages in the same tab, so you can sign in first and then go to the page. See the QA Guide.
When to bring in a developer
If your login page keeps redirecting inside the editor, your site's login doesn't work in a frame. Convert can't change that from our side. Ask your developer for one of these:
- a staging copy of the pages protected with HTTP Basic Authentication instead of a login page;
- a login that works when the page is framed by app.convert.com, at least on a staging site;
- temporary public access to the page while you build the variation.
Check Your Variation Before You Launch
Whatever the fix, check the variation outside the Visual Editor, the way a visitor uses the page:
- Open the variation's Preview, or the QA Overlay to check several pages in one go. See the QA Guide.
- Wait until the page has fully loaded, then use it: pick product options, open the cart, move to another route and come back.
- Check on mobile too. Scan the QR code in the Preview window with your phone.
- Before real visitors see it, run the experience with a QA audience as described in the QA Guide.
If the change still disappears, contact our support team. Send the page address, the experience ID, the step at which the change disappears, and the console output with convert_log_level=debug added to the page address.