Campaign pages and URL matching
A page in Personizely defines where a content or split URL campaign runs. It's a reusable URL rule: a single URL, a set of URLs matched by rules or a regular expression, or every page of your site. Pages are shared across your website, so you can reuse one page definition in several campaigns.
Used by: Content A/B testing with the visual editor and Split URL testing (redirect tests). Theme, template, price, shipping and full-stack campaigns don't use pages.
How matching works
Matching is done in the visitor's browser, on every page load, against the path of the current URL (for example /products/linen-shirt). The domain is ignored, so a page matches on every domain where your snippet runs. The query string (?color=blue) is ignored too, unless you turn on Include query.
Type | Matches | Notes |
|---|---|---|
Single page | Exactly one path | The URL you enter is reduced to its path. https://shop.com/pages/about matches /pages/about only, not /pages/about/team. |
Multiple pages | Every path that passes your Rules or RegExp | Needs an Editor URL for content campaigns: the URL the visual editor opens. |
All pages | Every page | Needs an Editor URL for content campaigns. Not available for split URL tests. |
Rules
Each rule is Include or Exclude pages containing, equaling, starting with or ending with a path. With two or more rules, you choose whether the page must match any or all of them.
- An Include rule passes when the path matches.
- An Exclude rule passes when the path does not match.
So, to mean "all product pages except one", combine the rules with all:
Policy | Operator | Path |
|---|---|---|
Include | starting with | /products/ |
Exclude | equaling | /products/gift-card |
With any, the same two rules would match almost every page, because any page that isn't the gift card passes the Exclude rule.
Rules are case-sensitive and compare plain text. containing /collections also matches /collections-archive.
RegExp
With RegExp, the Pattern is a JavaScript regular expression tested against the path (plus the query, if Include query is on). It matches if the pattern is found anywhere in the path, so anchor it with ^ and $ when you mean the whole path.
- ^/products/[^/]+$: every product page, but not /products/x/reviews.
- ^/collections/(shirts|pants): the shirts and pants collections, including filtered and paginated URLs.
- ^/(en|fr)/pages/faq$: the FAQ page in two locale folders.
An invalid regular expression never matches. In Split URL testing (redirect tests), capture groups such as $1 can be reused in the redirect URL.
Include query
With Include query on, the query string is part of what's matched. For a Single page, the URL must then match exactly, including every parameter in the same order. Leave it off unless the query string is what distinguishes the page, for example /search?q=sale.
When several pages match
A campaign can have several pages. If more than one matches the current URL, the most specific wins: Single page first, then Multiple pages, then All pages. The variation's changes for the winning page are applied, and the view is recorded against that page.
Set up a page
- In the campaign, under Pages, click Create a page, or pick an existing page from the list.
- Choose Single page, Multiple pages or All pages, and give it a Name.
- Enter the URL, or for multiple and all pages the Editor URL.
- For Multiple pages, choose Rules or RegExp and define them.
- Turn on Include query if needed, and click Save.
Option | What it does | Values / default |
|---|---|---|
Type | How URLs are matched | Single page (default), Multiple pages, All pages |
Name | Label shown in the campaign and reports | Required |
URL / Editor URL | The page to match (single), or the page the editor opens (multiple, all) | A full URL |
Match mode | Multiple pages only | Rules (default), RegExp |
Match | How several rules combine | any (default), all |
Rule | Include/Exclude + containing/equaling/starting with/ending with + path | Include, containing |
Pattern | RegExp mode only | JavaScript regular expression |
Include query | Match the query string too | Off |
Behavior details and limitations
- Pages are shared. Editing a page changes it in every campaign that uses it. Create a new page if you need a variant of an existing one.
- Removing a page from a campaign deletes its changes. The variations' changes for that page are removed from the campaign. A campaign must keep at least one page.
- The path doesn't include the domain. If you run the same snippet on several domains (for example per-market domains), a page matches on all of them. Use a Targets to limit the campaign by domain or market.
- Trailing slashes matter. /pages/about and /pages/about/ are different paths. Use Multiple pages with starting with, or a pattern like ^/pages/about/?$, if both can occur.
- Reports can be filtered by page. A campaign with several pages can be filtered to a single page in its report. See Reading campaign reports.
Examples
- One landing page: Single page, URL https://shop.com/pages/summer-sale.
- All blog articles: Multiple pages, Rules, Include pages starting with /blogs/news/.
- Every product page in Shopify, including collection-scoped URLs: Multiple pages, RegExp, /products/[^/]+$.