OptinStack

Configuration

Reference for the runtime configuration objects injected by the server.

The OptinStack runtime reads two global objects injected by the server before the SDK loads. You typically don't set these manually — they're generated by the OptinStack API based on your project settings.

These objects are documented for reference. In most integrations, the server script tag handles everything automatically.

window.optinstackMeta

Server-injected metadata about the current visitor and project.

PropertyTypeDescription
tier'lite' | 'pro' | 'business' | 'enterprise'Current project tier
regionstringDetected ISO-3166 region code (e.g. 'US', 'DE')
isEubooleanWhether the detected region is in the EU
domainstringCurrent website domain

window.optinstackConfig

Full project configuration including rules, trackers, providers, and storage settings.

Top-Level Properties

PropertyTypeDescription
projectIdstringUnique project identifier
versionstringConfiguration version
showOnConsentExpirybooleanWhether to re-show the banner when consent expires
storageStorageConfigCookie and consent storage settings
providersProvider[]Third-party service providers on the site
trackersTracker[]Cookies and storage items to manage
localesLocale[]Localization configuration
rulesRecord<string, RuleConfig>Region-based consent rules

storage

PropertyTypeDescription
endpointstringServer endpoint for syncing consent records
expiresnumberConsent cookie expiration in days
crossDomainConsentSharingbooleanWhether to share consent across subdomains
securebooleanWhether consent cookies require HTTPS

rules

Each rule maps to a region-specific consent behavior:

PropertyTypeDescription
mode'opt-in' | 'opt-out' | 'informational'Consent mode
bannerRule'opt-in' | 'opt-out' | 'informational' | 'dont-sell'Banner display type
regionsstringComma-separated ISO region codes or 'Global'
pagesstring[]URL paths where this rule applies (['*'] for all)
sourcestringURL to the banner HTML template
resetInteractionsbooleanWhether to reset interactions on consent renewal
disableScrollbooleanWhether to disable page scroll when the banner is open
animation{ duration, easing, animation }Banner animation settings

Rule Matching

The SDK evaluates rules in this priority order:

  1. Region match — a rule whose regions field contains the visitor's detected region
  2. EU match — if the visitor is in the EU and a rule includes 'eu' in its regions
  3. Global fallback — a rule with 'Global' in its regions

Premium projects use region-specific or EU rules when available. Free projects fall back to the Global rule.

On this page