ConsentMagic Pro / Tracking & Blocking / Custom Scripts

Custom Scripts

Last updated: February 12, 2026

The Custom Scripts tab is for anything ConsentMagic can’t reliably classify by default (custom trackers, niche analytics, custom embeds, in-house scripts, etc.).

What you can do here

  • Block manually added scripts (master switch)
    Enables/disables blocking for scripts you add yourself in this section.
  • Add script
    Use + Add script to create your own script definition. Once added, it appears in the table and is handled just like a “known” script (blocked/allowed based on consent and its assigned category).

Adding a Custom Script (New Script screen)

When you click + Add script, you’ll configure how ConsentMagic recognizes the script and which consent category controls it.

Fields

  • Name your script
    A label for your reference (ex: “Custom Chat Widget”, “Affiliate Tracker”, “Heatmap Tool”).
  • Script category
    Choose which consent category controls it (ex: Marketing or Analytics).
    This is the “permission” ConsentMagic will use when deciding whether the script should run.
  • JS Needle
    This is the detection key: you add unique identifiers that appear in the script’s:
    • src URL (for externally loaded scripts), and/or
    • inline script body (for embedded snippets)
    You can include:
    • script URLs/domains (ex: example-tracker.com/script.js)
    • JS globals / function names (ex: window.myTracker, myTrackerInit)
    • known snippet tokens (ex: parts of the vendor’s embed code)
    The goal is to give ConsentMagic reliable “needles” to match, so it can control the script consistently.
  • Your script description
    Optional text describing what it does (useful if you expose script/cookie info to visitors or for internal documentation).

Practical tips

  • Use 2–3 solid needles instead of many weak ones.
  • Prefer vendor domain + unique JS object when possible.
  • After adding, run your consent banner in an incognito window and test:
    • reject marketing/analytics → script should not run
    • accept → script should run