All Collections
Consent Management Solution
Auto Blocker
Implementing a Custom Blocking Map to change Auto Blocker's blocking behavior
Implementing a Custom Blocking Map to change Auto Blocker's blocking behavior
Updated this week

Termly custom blocking map

A custom blocking map can be used to customize Auto Blocker's behavior by recategorizing, blocking, or unblocking any scripts from a specific domain.

To recategorize, block, or unblock a single instance of a script, use manual blocking instead.

Note: Recategorizing cookies in your dashboard cookie report does not impact Auto Blocker behavior. The dashboard categorization only affects where cookies appear in your cookie policy and cookie preference center.

Configuring your custom blocking map

A custom blocking map must be defined on the page before you load Termly’s embed script. See the sample code below and adjust it to your needs.

Add the domains you are recategorizing in the format “example.com” and use one of the following five cookie categories: essential, performance, analytics, advertising, or social_networking. Keep this spelling and formatting to ensure the scripts are categorized correctly.

Example custom blocking map:

<!-- Termly custom blocking map -->
<script data-termly-config>
  window.TERMLY_CUSTOM_BLOCKING_MAP = {
    "example.com": "analytics",
    "xyz.com": "social_networking",
  }
</script>

To ensure your custom blocking map overrides Auto Blocker defaults, load it before your Termly embed script.

If your custom blocking map doesn't appear to be working correctly, make sure you are using "straight quotes" and not “smart quotes“ in the script.

Subdomain categorization

You can recategorize subdomains separately from the parent domain with a custom blocking map. Domains with higher specificity will take precedence over the general domain categorization. In the example below, "subdomain.example.com" categorization will take precedence over "example.com" categorization.

<!-- Termly custom blocking map -->
<script data-termly-config>
  window.TERMLY_CUSTOM_BLOCKING_MAP = {
    "example.com": "analytics",
    "subdomain.example.com": "performance",
  }
</script>
Did this answer your question?