Configuration

Every option on window.smartConsentConfig: version, language, theme, position and webhook URL. Each field has a sensible default.

4 min read · 7 sections

Overview

SmartConsent reads a single global object, window.smartConsentConfig, when the bundle loads. Every option is optional apart from version: if you set nothing else, SmartConsent applies its automatic defaults based on the visitor's detected jurisdiction.

javascript
window.smartConsentConfig = {
  version: 1,                                    // required: schema version
  language: "auto",                              // "auto" | ISO 639-1 code (e.g. "en", "fr")
  position: "bottom",                            // "bottom" | "bottom-left" | "bottom-right" | "top"
  theme: "auto",                                 // "auto" | "dark" | "light"
  webhookUrl: "https://your-api.example.com/consent",
  attributionUrl: "https://your-site.example.com" // optional: site URL for backlink badge
};

version

The config schema version, which is required. Set it to 1. SmartConsent uses it to apply migrations automatically when future schema changes ship, so your config keeps working without edits.

javascript
version: 1  // required

language

The banner copy language. 'auto' (default) detects from navigator.language and falls back to English if the detected language is not supported. You can also pass any ISO 639-1 code directly (e.g. 'en', 'fr', 'de').

  • Free tier: English only. Non-English visitors see the English banner.
  • Pro tier: banners are auto-translated at render time across all supported languages.

position

Where the banner renders on first paint. It defaults to 'bottom' (full-width bar, highest legibility). The three other variants are bottom-corner or top-banner styles.

  • "bottom": full-width bottom bar (default, recommended for GDPR button-equality).
  • "bottom-left": floating corner card, left edge.
  • "bottom-right": floating corner card, right edge.
  • "top": full-width top banner.

theme

Controls the banner colour palette. 'auto' (default) respects the visitor's prefers-color-scheme media query. For deeper visual overrides, target the .smartconsent-banner class directly with your own stylesheet (Pro tier).

javascript
theme: "auto"   // "auto" (default) | "dark" | "light"

webhookUrl

When set, SmartConsent POSTs a signed consent record to this URL every time a visitor accepts, rejects, or updates their preferences. Required for GDPR Article 7 record-of-consent compliance.

Webhook payload shape

json
{
  "event": "consent_given",
  "timestamp": "2026-04-15T10:23:17Z",
  "visitor_id": "sc_9f3a...",
  "regulation": "GDPR",
  "categories": {
    "essential": true,
    "analytics": true,
    "functional": true,
    "marketing": false
  },
  "signature": "sha256=..."
}

attributionUrl

Your site's canonical URL. It is used as the referrer when the 'Powered by SmartGenie' badge is clicked, so we can attribute installs correctly. It is optional: SmartConsent falls back to document.location.origin if you do not set it.

javascript
attributionUrl: "https://www.your-site.com"

Verify your installation

Run a free scan to confirm SmartConsent is gating scripts correctly, detecting your jurisdiction, and hitting a passing compliance score.

Run a free scan