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.
| Property | Type | Description |
|---|---|---|
tier | 'lite' | 'pro' | 'business' | 'enterprise' | Current project tier |
region | string | Detected ISO-3166 region code (e.g. 'US', 'DE') |
isEu | boolean | Whether the detected region is in the EU |
domain | string | Current website domain |
window.optinstackConfig
Full project configuration including rules, trackers, providers, and storage settings.
Top-Level Properties
| Property | Type | Description |
|---|---|---|
projectId | string | Unique project identifier |
version | string | Configuration version |
showOnConsentExpiry | boolean | Whether to re-show the banner when consent expires |
storage | StorageConfig | Cookie and consent storage settings |
providers | Provider[] | Third-party service providers on the site |
trackers | Tracker[] | Cookies and storage items to manage |
locales | Locale[] | Localization configuration |
rules | Record<string, RuleConfig> | Region-based consent rules |
storage
| Property | Type | Description |
|---|---|---|
endpoint | string | Server endpoint for syncing consent records |
expires | number | Consent cookie expiration in days |
crossDomainConsentSharing | boolean | Whether to share consent across subdomains |
secure | boolean | Whether consent cookies require HTTPS |
rules
Each rule maps to a region-specific consent behavior:
| Property | Type | Description |
|---|---|---|
mode | 'opt-in' | 'opt-out' | 'informational' | Consent mode |
bannerRule | 'opt-in' | 'opt-out' | 'informational' | 'dont-sell' | Banner display type |
regions | string | Comma-separated ISO region codes or 'Global' |
pages | string[] | URL paths where this rule applies (['*'] for all) |
source | string | URL to the banner HTML template |
resetInteractions | boolean | Whether to reset interactions on consent renewal |
disableScroll | boolean | Whether 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:
- Region match — a rule whose
regionsfield contains the visitor's detected region - EU match — if the visitor is in the EU and a rule includes
'eu'in its regions - 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.