Pageview Metrics
A pageview metric converts when a visitor navigates to a URL that matches a pattern you define. It is the most natural way to measure conversions that are represented by reaching a specific page: like a confirmation page after checkout, a thank-you page after signing up, or any section of your site that indicates meaningful engagement.
What pageview metrics track
Pageview metrics listen for URL changes as the visitor navigates your site: including both full page loads and client-side navigation in single-page applications. When the URL changes, A vs B checks whether the new URL matches the pattern you defined. If it does, and the visitor has not already converted on this metric, a conversion is recorded.
How to create a pageview metric
Go to the Metrics page
From your project dashboard, click Metrics in the left navigation.
Click New Metric
Click the New metric button. The metric creation form will open.
Choose Pageview as the type
Select Pageview from the metric type options.
Give it a name
Enter a descriptive name such as Thank You Page Visit, Order Confirmation, or Account Dashboard Reached.
Enter a URL pattern
Enter the URL you want to match against. The value you enter depends on which match mode you choose in the next step.
Choose a match mode
Select one of the six match modes: Simple, Exact, Path, Substring, Pattern, or Regex. A new metric starts on Path, the strictest reading of a goal page, and switching to another mode is one click. See the descriptions and examples below.
Save the metric
Click Save. The metric is now available to attach to experiments.
Match modes
A vs B offers six ways to match URLs. Choose the one that best fits the page you want to track.
| Mode | In plain English |
|---|---|
| Simple | This page (ignores tracking tags and trailing slashes) |
| Exact | Only this exact address |
| Path | This page's path |
| Substring | Any address containing this text |
| Pattern | Addresses matching a pattern with * |
| Regex | Full regular expression match |
Simple
Simple matching is the forgiving choice. It ignores anything after a ? (tracking tags like utm_source), anything after a #, and a trailing slash, on both what you enter and the address the visitor is on. Pages underneath the one you enter count too.
Enter a path such as /thank-you and it is compared with the page's path. Enter a full address such as https://example.com/thank-you and it is compared with the whole address, so another domain never matches.
Pattern: /thank-youMatches: /thank-you /thank-you/ /thank-you?order=123 /thank-you#receipt /thank-you/detailsDoes not: /checkout/thank-you /productsWhen to use: Almost always. It is the mode to reach for when you want "this page counted", whatever tracking tags happen to be on the link.
Exact
Exact matching requires the full address to match character for character. The protocol, domain, path, query string, and any trailing slash must all be identical.
Pattern: https://example.com/order-confirmationMatches: https://example.com/order-confirmationDoes not: https://example.com/order-confirmation?id=456 https://example.com/order-confirmation/When to use: When one stable address represents the conversion and you want nothing else to trigger it. Be aware that a single tracking tag on the link stops it matching.
Path
Path matching compares only the path part of the address. The domain, the query string, anything after a #, and a trailing slash are all ignored. Unlike Simple, a deeper page does not count: the path has to be the same one.
Path is what a new metric starts on, and it is the safest choice for a goal page: a metric for /cart fires on /cart and nowhere else, never on a deeper page and never on an address that merely contains that text.
Pattern: /order/confirmationMatches: /order/confirmation /order/confirmation/ https://example.com/order/confirmation?id=456Does not: /order/confirmation/print /orderWhen to use: When the same page is reachable on more than one domain, such as a staging site and a live site, and you want one metric to cover both.
Substring
Substring matching checks whether the text you enter appears anywhere in the full address, including the protocol, domain, path, and query string.
Pattern: confirmationMatches: https://example.com/order-confirmation https://example.com/account/confirmation?ref=email /booking-confirmationDoes not: /thank-you /successWhen to use: When the word that identifies a conversion page appears somewhere in the address but the rest of the path varies.
Pattern
Pattern matching lets you write the address with wildcards. * stands for any run of characters, including slashes, and ? stands for exactly one character. The whole address has to match from start to end, so remember a * at the end if the page can carry tracking tags.
Pattern: https://example.com/order/*/confirmation*Matches: https://example.com/order/1234/confirmation https://example.com/order/1234/confirmation?ref=emailDoes not: https://example.com/order/confirmation https://example.com/basketPatterns may contain letters, digits, and the characters / - _ . : & = % plus the * and ? wildcards. Anything else, such as a space or a bracket, is not a valid pattern and the metric will not fire.
When to use: When the address contains something that changes every time, like an order number, and you do not want to write a regular expression.
Regex
Regex matching tests the full address against a JavaScript regular expression. This is the most powerful mode and matches complex addresses, optional segments, or several paths with one rule.
Pattern: \/order\/(confirmation|success)(\?.*)?$Matches: /order/confirmation /order/success /order/confirmation?id=789Does not: /order/pending /order/Write the expression on its own, as in \/order\/(confirmation|success). Matching is case-sensitive by default. To pass flags, wrap the expression in slashes and put the flags after the closing one: /\/order\/confirmation/i matches whatever the capitalisation. The expression is tested against the whole address, not just the path, so it can match on the domain or the query string too. An expression that is not valid never matches, and nothing else on the page is affected.
How the snippet detects pageviews
The snippet monitors URL changes using two mechanisms. For traditional page loads, it checks the URL when the page first loads. For single-page application navigation, it monitors history.pushState, history.replaceState, and the popstate event so that client-side route changes are detected without a full page reload.
Each time the URL changes, the snippet evaluates all active pageview metrics against the new URL. Every match sends a conversion event to A vs B, even repeat visits to the same matching page in one session.
One conversion per visitor
Like all metric types, a pageview metric's conversion-rate result still counts each visitor at most once. Visiting the same matching URL multiple times only moves your count once, when the results are calculated: this reflects the real meaning of "this visitor converted" rather than counting return visits.
If you want to track the number of times a page is visited (not just whether a visitor visited it at all), use a custom event with avsb.track.event() inside your analytics layer instead of a pageview metric.