Show the right thing

Targeting rules

A campaign’s targeting decides who sees it, when, and how often. You set it on the campaign’s Targeting tab in the dashboard, or with the set_targeting tool. Meles decides in the browser, from your site’s published settings, so showing a campaign never waits on a request to Meles.

Rules

Every rule must hold, and the values within one rule are alternatives: “on /pricing or /plans, and on a phone”. A campaign with no rules is for everyone.

Rule Holds when
Page The page’s address matches: is exactly, starts with, contains or matches the pattern, where * stands for anything. A value starting with / is matched against the path and query, anything else against the whole address. One trailing / doesn’t matter to is exactly
Device The visitor is on a desktop, a tablet or a phone, as their browser says
Trait A trait you passed to identify() on this visit is equal to, not equal to, containing, starting with, more than, less than, one of, set or not set
Event An event you sent with track() has happened at least so many times this visit
Server A rule on what Meles has stored about the person: their traits, and events over all time or the last so many days. It’s checked on Meles’s servers, and its details never reach the browser
Sample The person is in the campaign’s sample, such as 10%. The same person gets the same answer every time, and raising the share never drops anyone already in
  • Types are strict: the text "10" is not the number 10. Text comparisons are case-sensitive.
  • A missing trait never matches, except not set: “plan is not free” doesn’t hold for someone with no plan.
  • A browser rule can’t name an identifying trait, such as an email address, a name or a phone number, and its value can’t look like an email address: your site’s settings are public. A server rule can.
  • A server rule needs a verified identify, so it holds for nobody who is anonymous: Identify your users.
  • A visit is a browser tab’s session.

When it shows

With no trigger, a campaign shows as soon as its rules hold. A delay waits so many seconds after the page view, up to an hour; moving to another page starts it again.

A scroll depth waits until the person has scrolled that far down the page, and exit intent until the pointer leaves the page towards the browser’s tabs or address bar, never on a phone or a tablet. Start and end dates show a campaign from the start up to the end: add a Dates rule on the Targeting tab and type them in your browser’s time zone, and Meles saves them in UTC; the set_targeting tool sets them in UTC.

How often

Frequency caps limit how often one person sees a campaign: at most so many times per visit, day, week, month or ever, and never again after they answer it or close it. A day, a week and a month are the last 24 hours, 7 days and 30 days.

Your site’s fatigue budget limits every campaign together, so nobody is badgered: Settings → Sites, your site, Fatigue budget. By default a person sees at most one campaign a visit and three a week, and none within 30 minutes of the last. A showing counts once, however it ends.

When more than one campaign could show, the one with the highest priority, set on its Targeting tab, wins, then the one published first. One campaign shows at a time.

Meles.show(campaignId) and the trigger_campaign tool skip a campaign’s rules, but never its caps or your fatigue budget, and their showings count like any other.

Why didn’t it show?

Check, in this order: the campaign is published; your page’s origin is one of the site’s allowed origins; the person has seen nothing from Meles in the last 30 minutes, or this visit, under the default budget; and each rule holds for them. Add data-debug to the script tag to see in the browser’s console what Meles ignored on your page.