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
Click New Metric
Choose Pageview as the type
Give it a name
Enter a URL pattern
Choose a match type
Save the metric
Match types
A vs B offers four ways to match URLs. Choose the one that best fits the pattern of the page you want to track.
Simple (pathname prefix)
Simple matching checks whether the URL's pathname starts with the value you enter. It is the most forgiving match type and works well when you want to capture any page under a particular path.
1Pattern: /thank-you2Matches: /thank-you3 /thank-you?order=1234 /thank-you/details5Does not: /checkout/thank-you6 /productsWhen to use: Tracking any page within a section, like all pages under /account/ or any URL that starts with /confirmation.
Exact
Exact matching requires the full URL to match precisely. The protocol, domain, path, and query string must all match exactly.
1Pattern: https://example.com/order-confirmation2Matches: https://example.com/order-confirmation3Does not: https://example.com/order-confirmation?id=4564 https://example.com/order-confirmation/When to use: When you have a single, stable URL that represents a conversion and you want no other URL to trigger it.
Substring
Substring matching checks whether the value you enter appears anywhere in the full URL — including the protocol, domain, path, and query string.
1Pattern: confirmation2Matches: https://example.com/order-confirmation3 https://example.com/account/confirmation?ref=email4 /booking-confirmation5Does not: /thank-you6 /successWhen to use: When the key word or phrase that identifies a conversion page appears somewhere in the URL but the full path may vary.
Regex
Regex matching tests the full URL against a JavaScript regular expression. This is the most powerful option and lets you match complex patterns, optional segments, or multiple paths with one rule.
1Pattern: /\/order\/(confirmation|success)(\?.*)?$/2Matches: /order/confirmation3 /order/success4 /order/confirmation?id=7895Does not: /order/pending6 /order/RegExp constructor with no flags by default, so matching is case-sensitive. If you need case-insensitive matching, use a non-capturing group at the start: (?i) is not supported, but you can use character classes like [Cc]onfirmation.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. If the pattern matches and no conversion has been recorded for this visitor on this metric, it sends the conversion event to A vs B servers.
One conversion per visitor
Like all metric types, pageview metrics record at most one conversion per visitor. Visiting the same matching URL multiple times only counts once. This reflects the real meaning of "this visitor converted" rather than counting return visits.
avsb.track.event() inside your analytics layer instead of a pageview metric.