Targeting, pages, audiences, and segments
Defines who and what page qualifies for experiments, feature flags, and personalization rules.
Simple terms
Targeting answers the question: who is eligible to see this thing, and on which pages?
Defines who and what page qualifies for experiments, feature flags, and personalization rules.
Routes
/audience/audience/new/audience/:id/edit/pages/pages/new
Implementation behavior
- Runtime page matching supports exact, wildcard, and regex URL rules.
- Segments combine page, traffic, behavior, customer, device, and Shopify/customer signals into reusable audience definitions.
- SDK-backed mutation experiments evaluate device, browser, browser version, OS, cookie, URL parameter, language, referrer, UTM, and visitor audiences client-side.
- Redirect experiments evaluated at the edge can only use URL, page, and URL-only segment criteria; use mutation experiments for non-URL audience criteria.
- Experiment targeting JSON can reference direct URL rules or saved segment rules depending on the workflow.
- Legacy pages redirect into the current audience system, but the underlying runtime still understands URL patterns.
How to use it
- Create broad page groups for repeated target surfaces such as PDP, cart, homepage, and collection pages.
- Use exact URLs for one-page tests, wildcard for families of pages, and regex only when pattern control is needed.
- Build saved audiences when the same visitor logic will be reused across tests, flags, or personalization.
- Review targeting before launch when an experiment does not appear in preview.
When not to use it
- Do not use a broad audience when a page-specific test only belongs on one surface.
- Do not use regex unless exact or wildcard matching cannot express the rule.
- Do not rely on behavior/customer signals before those signals are actually collected for the shop.
Implementation source
- Audience pages live under
src/app/(dashboard)/audience; legacy page routes live undersrc/app/(dashboard)/pages. - Handlers live under
/api/segmentsand/api/pages. - Matching logic is shared by dashboard targeting utilities and the SDK runtime URL/segment evaluation.
Data and API
- Prisma models:
SegmentwithrulesJSON,Page, andExperiment.targetingJSON. - APIs:
/api/segments,/api/pages, and analytics page data endpoints. - SDK URL matcher evaluates current location before assignment and mutation.
Failure modes
- No match because of protocol, trailing slash, query strings, or an overly narrow regex.
- Audience rule depends on a signal that has not been collected yet.
- Multiple eligible tests can conflict; check conflict output and traffic allocation.