Paywalls
Paywall rules determine which content is gated and how.
Evaluation order
Section titled “Evaluation order”Rules are evaluated in ascending priority order. The first matching rule wins.
Rule types
Section titled “Rule types”| Type | Behavior |
|---|---|
| Metered | Allow N free views, then deny |
| Hard | Deny unless the user has a matching subscription |
| Registration | Deny unless a userId is present |
| Soft | Grant access and return a paywall hint |
Conditions in the dashboard
Section titled “Conditions in the dashboard”The current dashboard form primarily exposes URL-based conditions.
Available URL operators are:
containsmatcheseq
The access engine also supports has_user and segment_id, but the current UI focuses on URL matching.
Action fields
Section titled “Action fields”Each rule stores:
productIds- optional
message - optional
meterLimit - optional
template— chooses which surface the SDK mounts whenLatch.showPaywall(result)runs (see UI Components) - optional
position— only meaningful forsticky-bar; eithertoporbottom
Templates
Section titled “Templates”The dashboard’s Create Rule form exposes five templates. Each maps to a Web Component shipped in @latch/ui:
| Template | Web component | Surface |
|---|---|---|
modal | <latch-paywall-modal> | Centered overlay that blocks the page until the reader subscribes or dismisses. The default. |
bottom-bar | <latch-sticky-bar> | Sticky bar pinned to the bottom of the viewport (position is forced to bottom). Non-blocking soft prompt. |
inline | <latch-inline-paywall> | In-flow card mounted into the element matched by paywallSelector on Latch.init() (falls back to <body>). Renders alongside content rather than over it. |
sticky-bar | <latch-sticky-bar> | Same as bottom-bar, but reads action.position (top or bottom). Use this when you want a top-pinned bar. |
inline-lock | <latch-content-lock> | Truncates the article with a gradient fade and renders a CTA overlay below. Place a <div id="latch-lock"></div> marker where the cut should start, or rely on auto-detection of <article> / <main>. |
For newsletter and data rule types, the SDK ignores template and routes to <latch-newsletter-wall> or <latch-data-wall> respectively.
Enable and disable
Section titled “Enable and disable”Rules can be toggled active or inactive without deleting them.
Soft paywalls
Section titled “Soft paywalls”Soft paywalls return granted: true. If you want a visible prompt for soft rules, your integration should inspect the returned paywallRule and render the prompt itself.
Content categories
Section titled “Content categories”Content categories live alongside paywall rules under Paywalls → Categories (formerly Settings → Content Categories; the old URL still redirects). A category mapping is just a URL pattern → category name pair: when a request URL matches the pattern, the access engine derives a content_category value, which is then available as a field in the rule builder.
The flow is:
- Define a mapping (e.g.
/sports/**→sports) under Paywalls → Categories. - In a paywall rule, add a
Content Categorycondition (e.g.is "sports"). The rule builder shows a Manage categories → deep-link next to the field for quick access. - At request time the engine resolves the request URL to a category, evaluates rules, and returns an access decision.
Old bookmarks for /settings/content-categories are redirected to /paywalls/categories.