Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io

    Variable System Reference

    Overview

    BillDog's variable system lets you inject dynamic data into paywall text, images, and other component properties at render time. Variables are resolved on the client using a deterministic priority chain that works identically across all platforms.

    Substitution Syntax

    Write a variable as {{variable_name}}, with or without spaces inside the braces, on every platform. ${variable_name} is not a variable: it shows as written. For advanced conditional logic, filters, and computed variables, see the xFlow Templating Reference.

    "text": "Welcome back, {{userName}}! Your plan: {{selectedProduct.title}}"

    userName here is one of the paywall's own variables: add it as a Parameter in the builder's Variables panel, so the builder offers it and Publish checks it, and pass its value by that name.

    Resolution Priority Chain

    When a variable is encountered, the resolver checks sources in this order:

    1. Variable Localizations — variableLocalizations[path][locale] with exact-match first, then language-only fallback (e.g., es-MX → es)
    2. Explicit Variables — variables[path] supplied as register params or configured in the dashboard
    3. Nested Dot-Path Resolution — a path not found as a flat key (selectedProduct.price) is walked through nested objects

    If no value is found at any level, a device shows nothing in its place. The builder canvas shows [path] instead, so a misspelled variable is visible while you edit.

    Built-in Variables

    BillDog computes the same product variables on iOS, Android and the web for every package in the offering. They are published under several names: selectedProduct.* is the product the customer has selected, primary.* and secondary.* the first and second, products.0.*, products.1.*, … each package by position, and monthly.*, annual.*, … each by package type. The builder's Variables panel lists every one. Common ones include:

    VariableExample Value
    selectedProduct.price$9.99
    selectedProduct.titlePremium Monthly
    selectedProduct.period1 month
    selectedProduct.dailyPrice$0.33
    selectedProduct.trialPeriodText7-day free trial
    primary.price$9.99
    annual.price$59.99
    device.platformios
    device.localeen-US
    user.isSignedIntrue

    A product sold in installments (Apple’s monthly plan with a 12-month commitment, Play installment plans) also sets isCommitment, installmentPrice, commitmentPaymentsCount, commitmentTotalPrice and commitmentPeriod; its price is the installment. See 12-Month Commitment Plans.

    Custom variables can be supplied as register params or configured in the dashboard.

    Signing a user in with BillDog Auth does not fill these in: session claims are never fed to the variable resolver, so an email or any other identity value must still be supplied as a register param (a Parameter variable, by its name) or configured in the dashboard. The eligibility flags user.isEligibleForIntro and user.hasUsedTrial are the exception — the renderer computes those from product eligibility, not from a session.

    Localizable Text Properties

    The following 14 component properties are eligible for localization. Each is resolved via the key format ${component.id}.${propertyName}:

    textbuttonTextplaceholdertitlesubtitlelabeldescriptioncontentheaderTextfooterTextdisclaimerctaTextheadlinesubmitLabel

    The last two, headline and submitLabel, belong to the Auth Card and are the only strings on it you can localize — its field labels, step copy, errors and provider button text come from the renderer, not from your config. See the Auth Card Reference.

    Key Format

    Translation keys follow the pattern:

    componentId.propertyName → e.g., "hero_title.text", "cta_button.buttonText"

    The localization resolver first attempts an exact locale match (e.g., pt-BR), then falls back to the language code (pt), using case-insensitive comparison.

    Setting Variables by Platform

    // Supply custom variables as register params —
    // the paywall for this placement resolves them automatically
    let result = try await BillDog.shared.register(
      placement: "settings",
      params: [
        "user.tier": "premium",
        "promo.discount": "20%"
      ]
    )

    Selection-Reactive Dynamic Values

    Dynamic values attached to interactive components react in real-time when the user switches selected products on-device:

    • products.selectedIndex — Updates dynamically to reflect the zero-based index of the currently tapped product card.
    • selectedProduct.* — Variables like {{selectedProduct.price}}, {{selectedProduct.title}}, or {{selectedProduct.period}} (e.g. “1 month”) and {{selectedProduct.periodShort}} (e.g. “/mo”) re-resolve immediately to the selected package.
    • Cross-Surface Parity — Supported natively across iOS SwiftUI (ProductsRenderer & PaywallStateManager), Android Jetpack Compose (PaywallScreen), and the WebView renderer.
    // CTA button text adapting dynamically to the user's tapped product:
    "Start 7-Day Trial, then {{selectedProduct.price}}{{selectedProduct.periodShort}}"

    Element Variables

    For per-component overrides, use the element: prefix:

    element:hero_title.text → Overrides the "text" property of the component with ID "hero_title"

    Element variables take the highest priority and bypass the normal resolution chain.

    Changing a Variable with a Tap

    An Update Variable tap action sets, toggles, increments or decrements one of your paywall’s own variables — a state variable from the Variables panel, or an element’s state such as a drawer’s isOpen. Text bound with {{name}}, Dynamic Values and later actions’ conditions follow the new value at once, in WebView and native paywalls alike, and choosing another product does not reset it.

    Refer to a variable by its name ({{isVip}}); the Variables panel’s copy button gives you that. The values BillDog computes — device.*, time.*, user.*, products.* and the product variables — can’t be changed by a tap, and publishing refuses an Update Variable aimed at one. To change the selected product, use Select Product.

    {{variables}} in a tap action’s own settings — a link, text to copy or share, a custom event’s name — are filled in when the action runs, so a value an earlier action in the same tap wrote is the one used.

    Select Product

    A Select Product tap action chooses a product the way tapping its card does: every products component showing it highlights it, the product variables follow, and a later Purchase buys it. Primary, Secondary and Tertiary are the first three products of the paywall’s offering, in its order — Primary and Secondary are the products {{primary.*}} and {{secondary.*}} describe. By Index counts from 0 in the same order; By Identifier names the product.

    Was this page helpful?

    Or rate this page:

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.