Multi-page & Global Changes
Every edit you save in the Visual Editor can be scoped by page URL. This is the sibling of responsive scope: responsive scope decides at which screen widths a change applies, URL scope decides on which pages it applies.
Select an element, then open the Scope section in the Inspector. A segmented control offers three choices: This page, All experiment pages, and URL pattern. New edits default to This page, so existing single-page behaviour is unchanged until you choose otherwise.
The three scopes
- This page: The change applies only on the page you authored it on. The editor records that page's URL when you make the edit; the runtime matches it by path, ignoring the query string, hash, and a trailing slash. This is the default.
- All experiment pages: The change applies on every page the experiment runs on. Use this for site-wide elements, such as a header logo, a navigation label, or a sticky banner, that should change everywhere the experiment is active.
- URL pattern: The change applies wherever the visitor's URL matches a pattern you supply, under a match type you choose. Use this to target a section of the site (for example, all product pages) without editing each page individually.
URL scope is a per-change filter that runs inside an active experiment. The experiment's own targeting rules decide which pages the experiment runs on at all; URL scope then decides which of that variation's changes apply on the current page. A change can never fire on a page the experiment doesn't target.
URL pattern match types
Choosing URL pattern reveals a pattern field and a match-type dropdown. The six match types are the same vocabulary used by experiment URL targeting:
- Starts with (path): the page path begins with your value (e.g.
/productsmatches/products/shoes). - Exact URL: the full URL matches exactly, after normalising the trailing slash, hash, and query-parameter order.
- Path equals: the page path equals your value exactly.
- URL contains: the full URL contains your value anywhere.
- Wildcard pattern:
*matches any run of characters and?matches a single character (e.g./blog/*/comments). - Regex: your value is treated as a regular expression matched against the full URL.
How the runtime applies URL scope
When the snippet runs, it evaluates each change against the current page URL before the viewport check. Changes whose scope matches are applied; the rest are skipped on this page but stay eligible on the pages they belong to.
The conceptual runtime logic looks like this:
type VisualChangeScope = 'PAGE' | 'EXPERIMENT' | 'PATTERN'type UrlMatchType = 'SIMPLE' | 'EXACT' | 'PATH' | 'SUBSTRING' | 'PATTERN' | 'REGEX'interface ScopedChange { scope: VisualChangeScope pageUrl: string | null urlMatchType: UrlMatchType | null}// The runtime's own URL helpers.declare function stripSlash(path: string): stringdeclare function pathOf(url: string): stringdeclare function urlMatches(href: string, pattern: string, matchType: UrlMatchType | null): booleanfunction appliesOnThisPage(change: ScopedChange, href: string, pathname: string): boolean { switch (change.scope) { case 'EXPERIMENT': // Experiment targeting already matched this page. return true case 'PAGE': // Path match, trailing-slash insensitive; query and hash ignored. // A change saved before URL scope existed has no page URL and // applies everywhere (unchanged legacy behaviour). if (!change.pageUrl) return true return stripSlash(pathname) === stripSlash(pathOf(change.pageUrl)) case 'PATTERN': if (!change.pageUrl) return true return urlMatches(href, change.pageUrl, change.urlMatchType) }}Single-page applications
On SPA sites that change the URL without a full page load, the snippet re-evaluates the active experiment on every route change. URL scope is re-checked as part of that pass, so a This page change stops applying when the visitor navigates away and an All experiment pages change keeps applying across routes, no reload required.
URL scope gates direct element edits (text, styles, visibility, images, inserts, moves). Element-state styles (:hover, :focus) and any free-form variation CSS are compiled into one stylesheet for the whole variation, so they are not URL-gated on their own: they take effect wherever their selector exists while the experiment is active. If you scope a hover restyle to a single page, spot-check the other pages in the experiment during QA.
Related
- Responsive Edits: the screen-width sibling of URL scope; the two stack on the same change.
- URL targeting: set which pages the experiment runs on in the first place.
- Execution order: where URL-scope evaluation sits in the snippet lifecycle.