Targeting attributes
Tell the SDK about your visitor so placements can pick an audience, and handle the case where nothing is shown.
Placement audiences can test facts about the visitor, like plan or country. Your site passes those facts as attributes. They are compared in the visitor's browser and are never sent to Miniwall. Miniwall stores only the rules.
type Attributes = Record<string, string | number | boolean | null | undefined>;Passing attributes
| Where | Use |
|---|---|
configure({ attributes }) | Defaults for the whole page. |
setAttributes(partial) | Adds to or changes the saved attributes, for example after sign-in. A value of null removes one. |
attributes option of a call | Merged over the saved ones for that call only. |
| React | attributes prop of <Paywall>, or usePaywall({ attributes }), useAutoPlacements({ attributes }). |
| Web component | The visitorAttributes property (attributes is already a built-in name of every element). |
UIKit.configure({ apiKey: 'pk_...', attributes: { plan: 'free' } });
// after the user upgrades:
UIKit.setAttributes({ plan: 'pro', country: 'VN' });In the dashboard a condition on plan is Attribute from your site with the name plan. Names start with a letter and use letters, numbers and _, up to 40 characters.
Built-in facts
These need no attributes: locale (the call's locale, else navigator.language), device (mobile, tablet or desktop), path (location.pathname), seen_count and days_since_first_seen. See Audience for exact rules.
When nothing is shown
Targeting applies to sources of the form { placement }. In order: the frequency limit, the first matching audience, the holdout. See Audience.
type SkipReason = 'frequency_cap' | 'audience' | 'holdout';| Where | You get |
|---|---|
presentPaywall | Resolves { outcome: 'skipped', reason }. Nothing opens. |
mountPaywall | A handle with shown: false and skipReason. Nothing is drawn. |
| Any call | onSkip({ reason }) is called. |
| Web component | A uikit-skipped event with detail.reason. |
startAutoPlacements | onResult receives the skipped result. |
A holdout skip records a holdout event. The other two send nothing.
Rules in the browser
- Text comparisons ignore case. A missing,
nullor empty value fails every comparison except is not and is not set. - Number comparisons need numbers on both sides.
- The frequency counters and the first-visit date are kept in
localStorage(uikit:shown:*,uikit:first-seen) andsessionStorage(uikit:session-shown:*).