Survey Targeting & Display Conditions
Show the right survey to the right person
Survey targeting controls who sees a survey and when. BillDog evaluates every eligibility check server-side inside the bdsurvey-fetch edge function, so the SDK only ever receives a survey it is actually allowed to display. This guide enumerates the real display conditions, audience rules, and sampling controls available in the Survey Builder.
Server-Authoritative Eligibility
bdsurvey-fetch with the current customer/anonymous id and context (country, platform, app version, SDK version, custom attributes, experiment variants), and the server returns either the full survey config with should_show: true or a refusal with a should_show: false + reason. Feature-flag, audience, and sampling logic all run server-side — there is no local bucketing in the client SDK.1. How Eligibility Is Evaluated
When the SDK requests a survey, bdsurvey-fetch runs a deterministic gauntlet of checks. The first check that fails short-circuits and returns a refusal reason — nothing else is evaluated.
Collector status & schedule
If fetched via a collector, it must be active and not type-mismatched. Collector window is checked via opened_at / closed_at (reasons: collector_inactive, collector_not_opened, collector_closed).
Survey-level quota
Survey-wide response cap (bdsurvey_quotas). If current_count >= max_responses the survey is withheld (reason: quota_exceeded).
Survey status
Survey must have status 'active' (reason: survey_inactive).
Audience & display conditions
resolveSurveyEligibility evaluates the targeting rules + display conditions (URL match, feature flag, person/group properties). Failures return the rule's reason.
Survey scheduling
scheduled_start / scheduled_end window (reasons: not_started_yet, survey_ended).
A/B variant assignment
If the survey is part of a variant_group, a stable hash of the customer/anonymous id picks one variant deterministically.
Show-once
If show_once is enabled and this identity already has a completed response, the survey is withheld (reason: already_completed).
Presentation percentage (sampling)
A stable 1–100 hash roll on the identity gates a percentage of traffic (reason: presentation_percentage_filtered).
Per-choice quotas
Choices whose quota is full with action_on_full = 'hide_option' are stripped from the returned config.
mobile_display config, and bdsurvey-fetch never reads it. The renderer reads mobile_display.accessControl only to decide whether the survey may be dismissed, and compares it against restricted — which is not one of the three values the builder writes. Treat the setting as unenforced today. To actually withhold a survey from signed-out or non-paying users, use the subscription_status and entitlement audience rules in section 3, which do run server-side.2. URL / Route Targeting
The URL match display condition (display_conditions.url_match) restricts a survey to specific routes or screens. Set an operator (dcUrlOperator) and a value (dcUrlValue, e.g. /pricing).
| Operator | Builder Label | Behavior |
|---|---|---|
exact | Exact | URL must equal the value exactly. |
contains | Contains | URL contains the value as a substring (default). |
not_contains | Does not contain | URL must not contain the value. |
regex | Regex | URL matches the supplied regular expression. |
3. Audience & Property Targeting
The Universal Audience Builder attaches a set of targeting rules combined with AND / OR logic. With no rules, everyone is eligible (subject to status, schedule, and sampling). Each rule has one of the following type values:
segmentSegmentMembership in a reusable saved segment (in_segment).
attributeAttributeA known person property (e.g. plan, tier).
custom_attributeCustom AttributeA free-form custom attribute key passed by the SDK.
countryCountryCountry code from request context.
platformPlatformios / android / web etc.
app_versionApp VersionHost app version (supports version comparisons).
sdk_versionSDK VersionBillDog SDK version.
subscription_statusSubscriptionactive, trial, canceled (still paid through the period), grace_period, billing_retry, paused, expired, refunded, access_restricted or none.
entitlementEntitlementWhether the user holds a named entitlement.
event_fired_in_windowEvent WindowWhether a named event fired within a time window.
experiment_variantExperiment VariantAssigned variant for a given experiment.
country, platform, app_version, sdk_version,custom_attributes, experiment_variants), and the server evaluates the rules against it.Organization seats and the entitlement rules
entitlement and subscription_status rules resolve against the customer BillDog is targeting — the entitlements materialised on that customer’s own record and the attributes forwarded for it. If your users sign in through BillDog Auth, that is incomplete for anyone in an organization. The organization has a customer record of its own, and a member’s entitlements are the union of the personal ones and the organization’s — but only the personal half is written onto the member’s customer row. The inherited half exists solely in the ent claim of their session token, and bdsurvey-fetch never reads a session token. A paying seat in a subscribed organization can therefore fail one of these rules and never be shown the survey. Where the rule has to hold for seats, verify the session token on your own server, read ent, and forward the answer as a custom attribute — then target that with the custom_attribute rule above. See Verifying Tokens on Your Server.4. Feature-Flag Targeting
The feature flag display condition (display_conditions.feature_flag) gates a survey behind a flag. Set the flag key (dcFeatureFlagKey, e.g. my-flag) and, optionally, a required variant (dcFeatureFlagVariant, e.g. control). If the variant is left blank, the survey shows whenever the flag is simply enabled for the user.
Evaluated Server-Side
bdsurvey-fetch eligibility. The client SDK does not perform local flag bucketing for surveys — it forwards identity + context and trusts the server's should_show decision. This keeps flag definitions authoritative and prevents drift between the dashboard and the device.5. Sampling, Frequency & Show-Once
Even after a user is eligible, you can throttle how often and to what fraction the survey actually appears.
Presentation percentage presentationPercentage → settings.presentation_percentage
A 0–100 slider (5% steps). The server hashes the customer/anonymous id into a stable 1–100 roll; if the roll exceeds the percentage, the survey is withheld with reason presentation_percentage_filtered. Because the hash is deterministic per identity, the same user consistently lands in or out of the sample.
Show once showOnce → settings.show_once
When enabled, a user who already has a completed response will never be shown the survey again (reason already_completed). The lookup fails safe — a lookup error is treated as "not yet completed" rather than blocking the fetch.
Wait period waitPeriodDays → settings.wait_period_days
A cool-down (in days) before a user becomes eligible / re-eligible, governing recurring re-display cadence. Pair with the recurring options (e.g. re-show on every trigger) to control repeat exposure.
6. Event & Context Triggers
Surveys are surfaced at known SDK collector contexts rather than from an arbitrary client event. The survey's type aligns the survey to a moment in the user journey:
exitExit SurveyShown as the user leaves a flow (e.g. paywall_exit context).
post_purchasePost-PurchaseShown immediately after a successful purchase.
onboardingOnboardingShown during the onboarding sequence.
standaloneStandaloneFetched explicitly by the host app on demand.
npsNPSNet Promoter Score prompt.
csatCSATCustomer satisfaction prompt.
customCustomHost-defined surfacing point.
Event Triggers
checkout_completed) and optional Property Filters (JSON, e.g. {"plan":"pro"}); these persist todisplay_conditions.event_trigger. The SDK arms triggered surveys (armEventTriggeredSurveys()) and presents the survey when a matching event is tracked — still subject to all gating (recurrence, wait period, sampling, other display conditions). Evaluation is client-side and consistent across web, iOS, and Android; the server returns the config but does not fire the trigger. Collector contexts (paywall_exit,post_purchase) and the event_fired_in_window audience rule remain available too.Related Guides
Was this page helpful?
Or rate this page: