NexaGuard
    NexaGuard
    • NexaGuard Onboarding
    • iOS Setup
    • Android Setup
    • Web Setup
    • Webflow and Wix
    • WordPress Integration
    • Drupal Integration
    • Shopify Integration
    • LICENSE

    Web Setup

    NexaGuard CMP SDK – Web & GTM Setup#

    Package<script id="nexaguard-cmp" …>
    MinimumEvergreen browsers · ES6
    Footprint≈ 12 kB gzipped loader

    1 Option A: Direct Script Embed#

    Place the loader <script> as high as possible in your <head>:
    Required attribute
    AttributeValueDescription
    data-settings-ide.g. NXG-Zmk9Zy0c1XIdentifies your site’s branding & vendor list.
    Optional attributes
    AttributeDefaultUse-case
    data-api-urlhttps://api.nexaguard.ioOverride for self-hosted API.
    data-assets-urlCDN path inferred from srcPoint loader at a staging CDN.
    data-consent-modeonSet to "off" to disable Google Consent Mode defaults/updates and revert to tag blocking.

    2 Option B: Google Tag Manager (recommended)#

    NexaGuard CMP is also available as a GTM Custom Tag Template.
    This ensures Consent Mode defaults fire at Consent Initialization – All Pages, before any Google tags.

    Step-by-step setup#

    1.
    Import the template
    Download the NexaGuard CMP .tpl file from your dashboard.
    In GTM → Templates → Tag Templates → New → Import, select the .tpl.
    Save as NexaGuard CMP.
    Screenshot: Import template
    2.
    Create a new tag
    GTM → Tags → New → Tag Configuration.
    Choose NexaGuard CMP.
    Fill in the fields:
    Settings ID → your NexaGuard CMP ID (from dashboard).
    Other fields (developerId, region defaults, loader URLs) can remain at defaults.
    Screenshot: Create tag
    3.
    Add a trigger
    Under Triggering, select Consent Initialization – All Pages.
    This ensures consent defaults load before gtag.js or any Google Ads/Analytics tags.
    Screenshot: Add trigger
    4.
    Publish the container
    Click Submit → Publish and Create Version.
    Name the version (e.g. NexaGuard CMP v1.0) and click Publish.
    Screenshot: Publish
    5.
    Verify in Tag Assistant
    Open Tag Assistant → Preview on your site.
    On page load you should see:
    consent default fired at Consent Initialization.
    Defaults: denied for EEA/UK/CH, granted elsewhere.
    After “Accept All” you should see:
    consent update with all four signals = granted.

    3 Trigger the banner manually (optional)#

    The banner auto-shows on first visit. To open it on demand:

    4 API parity with mobile#

    CallPurpose
    initialize(settingsId) (auto)Loads branding & GVL; stores consent.
    showBanner({ force })Displays banner even when consent stored.
    acceptAllSelections() / rejectAllSelections()One-click options in second layer.

    5 Consent Mode: Basic vs. Advanced#

    NexaGuard CMP fully supports Google Consent Mode.

    What are the options?#

    Basic configuration
    Google tags are blocked until the user provides consent.
    No analytics, ads, or personalization tags will fire before the user’s decision.
    Advanced configuration
    Google tags fire immediately on page load, even before the user provides consent.
    Tags collect only limited, anonymized (cookieless) signals until the user makes a choice.
    Once a consent decision is made, tag behavior updates automatically.
    Note: Consent Mode is a technical solution for tag management and measurement.
    It does not by itself ensure legal compliance (such as with GDPR).
    For more details and implementation options, see:
    Consent Mode – Basic
    Consent Mode – Advanced

    How to select your configuration#

    By default, NexaGuard CMP uses the “Basic” (blocking) mode.
    To switch to Advanced mode (allow tags before consent), set data-consent-mode="on" explicitly or enable it in the dashboard.
    To disable Consent Mode completely, set data-consent-mode="off". This reverts to full tag blocking.

    5.1 Creating a Google-Ready Banner (Consent Mode v2 Template)#

    NexaGuard CMP includes a pre-built banner template that already meets Google’s banner requirements:
    Fully configurable from the Dashboard (text, logo, colors, buttons).
    Pre-filled message:
    “We use cookies to personalize ads and measure performance. Learn more at Google’s Privacy & Terms.”
    Includes clear Accept All and Reject All actions for affirmative consent.
    Supports both TCF and non-TCF implementations.

    Steps#

    1.
    Go to Dashboard → Banner Templates → Google Consent Mode v2.
    2.
    Click Create Banner.
    3.
    Customize your design (logo, colors, text).
    4.
    In Consent Mode Settings, ensure the four v2 consent types are mapped:
    ad_storage
    analytics_storage
    ad_user_data
    ad_personalization
    5.
    Save and Publish.
    6.
    Verify implementation using:
    Tag Assistant or
    https://cmp.nexaguard.com/?nxg_debug_ui=1 (interactive audit overlay).
    This configuration automatically fulfills Google’s banner requirements (section v).

    6 Debug Mode (developer helper)#

    To help validate Consent Mode ordering and TCF status, NexaGuard CMP includes an interactive debug tool.

    🧭 Open from URL#

    Append one of these parameters to any page URL where NexaGuard CMP is installed:
    ParameterBehavior
    ?nxg_debug=1Runs a background audit and logs a JSON report to the browser console.
    ?nxg_debug_ui=1Opens a floating NexaGuard Consent Audit overlay on screen with live updates.
    Example:
    https://example.com/?nxg_debug_ui=1

    🧰 Run from the browser console#

    You can also open or refresh the audit manually:
    When active, the overlay shows:
    Developer ID and consent signal values (ad_storage, analytics_storage, ad_user_data, ad_personalization).
    TCF API presence and locator iframe detection.
    Index order of consent default, gtag('js'), and gtag('config').
    Live updates when consent or TCF events change.
    Buttons to Refresh, Copy report, or Close.
    Tip: Use this mode during audits or integration tests to confirm your gtag() and Consent Mode defaults fire in the correct order.

    Full docs ➜ https://developer.nexaguard.com

    © 2025 NexaGuard Inc. All rights reserved.
    Previous
    Android Setup
    Next
    Webflow and Wix