Gated Content

Data Attributes

Gate content using data attributes on standard HTML elements.

Use the data-fanid-gated attribute to gate any standard HTML element. This approach works with CMSes that strip unknown HTML tags.

Basic usage

<div data-fanid-gated>
  <h2>Premium Player Statistics</h2>
  <table>...</table>
</div>

The SDK automatically scans for [data-fanid-gated] elements when it initializes, and watches for new ones added dynamically (SPA support via MutationObserver).

Per-element configuration

Use additional data attributes to override global settings:

<div
  data-fanid-gated
  data-fanid-title="VIP Content"
  data-fanid-message="Sign in to see exclusive stats"
  data-fanid-button="Join Now"
  data-fanid-style="gradient"
>
  <p>Protected content here</p>
</div>

Attribute reference

AttributeDescription
data-fanid-gatedMarks the element for gating (required, no value needed)
data-fanid-titleOverride the overlay heading
data-fanid-messageOverride the overlay description
data-fanid-buttonOverride the CTA button label
data-fanid-styleOverride visual style: blur, gradient, or cover
data-fanid-min-heightMinimum height (px) for the gated overlay
data-fanid-max-heightMaximum height (px) — collapses content below and clips overflow
data-fanid-overlay-alignPrompt placement: top (default), center, or bottom

Keeping the prompt above the fold

When a section is tall, the sign-in CTA can land below the viewport. Set data-fanid-max-height to cap the gated area, and the overlay sits at the top by default — the user sees the prompt without scrolling.

<div
  data-fanid-gated
  data-fanid-max-height="360"
  data-fanid-overlay-align="top"
>
  <article>...long premium article...</article>
</div>

How it differs from the Custom Element

Custom ElementData Attributes
Tag<wmt-fanid-protected>Any standard element
Overlay injectionInside the custom elementInside the target element
CMS compatibleMay be stripped by some CMSesWorks everywhere
Ad-blocker resistanceRandomized CSS class namesRandomized CSS class names

Dynamic content (SPA)

Elements with data-fanid-gated that are added to the DOM after page load are automatically detected and gated. This works with single-page applications, client-side routing, and dynamically loaded content.

// This element will be automatically gated when appended
const el = document.createElement('div')
el.setAttribute('data-fanid-gated', '')
el.innerHTML = '<p>Dynamically gated content</p>'
document.body.appendChild(el)
Copyright © 2026