Targeting Rules

Overview

The tracking script includes a rule engine that evaluates targeting conditions for audiences, locations, segments, and goals. Rules are combined with AND/OR/NOT logic and support multiple comparison operators.

Rule Categories

URL Rules

RuleWhat It MatchesExample
URL / PathPage pathname/products/shoes
Full URLComplete URL including protocol, domain, query, hashhttps://example.com/page?ref=123
Protocolhttp: or https:https:
HostnameDomain and subdomainshop.example.com
Query StringFull query string?utm_source=google&utm_medium=cpc
Query ParameterValue of a specific parameterutm_source equals google
FragmentURL hash/anchor#/dashboard/settings

Geographic Rules

RuleWhat It MatchesExample
CountryISO 3166-1 alpha-2 country codeUS, GB, DE
Region / StateState or provinceCalifornia, TX
CityCity nameSan Francisco
ContinentContinent codeNA, EU, AS
Zip CodePostal code94103

Geographic data is loaded on-demand. If a rule requires geo data that hasn't arrived yet, the evaluation is deferred until the data is available.

Device & Browser Rules

RuleWhat It MatchesPossible Values
Device TypeDevice categoryAll phones, iPhones, other phones, all tablets, iPads, other tablets, desktops, other
Screen SizeViewport dimensionsWidth and height in pixels
BrowserBrowser nameChrome, Firefox, Safari, Edge, Opera, Internet Explorer, other
Browser LanguageLanguage codeen-US, fr-FR, de-DE
Operating SystemOS nameWindows, macOS, Linux, Android, iOS, iPadOS

Time Rules

RuleWhat It MatchesRange
Day of WeekCurrent daySunday through Saturday
Day of MonthCurrent date1 through 31
Month of YearCurrent monthJanuary through December
Hour of DayCurrent hour0 through 23
Time RangeDate/time windowStart and end timestamps

Time rules use the visitor's local time, not server time.

Weather Rule

RuleWhat It MatchesNotes
WeatherCurrent weather conditionLoaded on-demand (same as geo data)

Visitor Behaviour Rules

RuleWhat It MatchesExample
Visitor TypeNew or returningNEW, RETURNING
First TimeFirst exposure to this experiencetrue / false
Visits CountTotal page views across all sessions> 10
Pages CountPages viewed in current session>= 3
Sessions CountTotal sessions> 5
Goals CountTotal goals triggered (all time)> 0
In SegmentVisitor belongs to a segmentSegment ID

Traffic Source Rules

RuleWhat It MatchesExample
UTM Sourceutm_source parametergoogle
UTM Mediumutm_medium parametercpc
UTM Campaignutm_campaign parametersummer_sale
UTM Keywordutm_term parameterrunning shoes
ReferrerFull referrer URLhttps://google.com/search?q=shoes
Referrer DomainReferrer hostnamegoogle.com

Cookie Rule

RuleWhat It MatchesExample
CookieValue of any cookieCookie user_tier equals premium

DOM Element Rules

RuleWhat It MatchesExample
Element VisibleCSS selector is visible on page.promo-banner is visible
Element Contains TextText content of an elementh1 contains Sale

Custom Data Rules

RuleWhat It MatchesExample
JavaScript ConditionResult of custom JS codereturn window.userPlan === 'enterprise'
Custom VariableRuntime variable set via APIVariable vip_status equals gold
Page TagWindow variable valuewindow._conv_page_type equals product

Bucketing Rules

RuleWhat It MatchesExample
In ExperienceVisitor is bucketed into a specific experienceExperience 100456
In VariationVisitor is bucketed into a specific variationExperience 100456, Variation 100789

Goal Rule

RuleWhat It MatchesExample
Goal TriggeredA specific goal has been triggeredGoal 100999 was triggered

Comparison Operators

OperatorDescription
EqualsExact match (case-sensitive)
Does Not EqualNot equal
ContainsSubstring match
Does Not ContainNo substring match
RegexRegular expression match
Starts WithPrefix match
Ends WithSuffix match
Less ThanNumeric comparison
Less Than or EqualNumeric comparison
Greater ThanNumeric comparison
Greater Than or EqualNumeric comparison

Logical Operators

Rules are combined using:

  • AND — All rules must match
  • OR — At least one rule must match
  • NOT — Negate a rule result

Deferred Evaluation

When a rule requires data that isn't immediately available (geographic location, weather), the evaluation is paused:

  1. The experience/segment/goal is placed in a deferred queue
  2. The tracking script requests the additional data from the CDN
  3. When data arrives, all deferred evaluations are re-run

This happens transparently — no configuration needed.