# GTM Cookie Blocking with Secure Privacy | Setup Guide

> Learn how to block cookies in Google Tag Manager using Secure Privacy's sp-consent custom event triggers — step-by-step guide for creating triggers and attaching them to GTM tags.

- Canonical: https://support.secureprivacy.ai/article/howto-manually-block-cookies-using-google-tag-manager
- Product: Consent Management
- Category: FAQs
- Published: 2026-03-06T12:43:00+00:00
- Updated: 2026-03-27T22:06:31.741+00:00
- Reading time: 3 minutes

---

This guide explains how to block cookies and trackers in **Google Tag Manager (GTM)** using Secure Privacy's custom consent event triggers — using Google Analytics as a working example. By attaching `sp-consent` custom event triggers to your GTM tags, you can ensure third-party scripts only fire after a visitor has given the appropriate consent.

**Prerequisites:** This guide assumes you have already created a GTM account, set up a website container, and added the GTM container snippet to your website. See [Google's GTM setup guide](https://support.google.com/tagmanager/answer/6103696) for help. It also assumes Secure Privacy is already installed on your website. If not, see [how to implement Secure Privacy with GTM](https://support.secureprivacy.ai/article/how-to-install-secure-privacy-with-google-tag-manager-gtm/) before proceeding.

## Who Is This For?

-   Developers and tag managers implementing Secure Privacy cookie blocking via Google Tag Manager
    
-   Compliance teams ensuring third-party scripts only fire after visitor consent is obtained
    
-   Website administrators using GTM to manage analytics, advertising, and tracking tags with consent controls
    

## How to Block Cookies Using a GTM Custom Event Trigger

The following steps use **Google Analytics** as the example plugin. Repeat the same process for each additional plugin or service you need to block.

### Step 1: Create a custom event trigger in GTM

1.  In your GTM container, navigate to **Triggers** and click **New**.
    
2.  Select **Custom Event** as the trigger type.
    
3.  In the **Event Name** field, enter the consent event for the plugin you want to block — using the format: `sp-consent="PLUGIN NAME"`
    
    The exact plugin name must match the service name shown in your Secure Privacy account under **Classification** in the Scan Report. For example, to block Google Analytics, enter: `sp-consent="Google Analytics"`
    
4.  Name the trigger clearly — for example, **SP-Consent-Google-Analytics** — so it is easy to identify in your tag configuration.
    
5.  Click **Save** to create the trigger.
    

![GTM Custom Event trigger configuration showing Event Name field with sp-consent equals Google Analytics and trigger named SP-Consent-Google-Analytics](https://pub-7bd19505838640d0a08ef1bd6ec3fb9b.r2.dev/articles/cc9cffc75b99a1cb4eb1-161ff3a80d2c.webp)

Repeat this process for each plugin or service you need to block — creating one custom event trigger per service.

### Step 2: Attach the trigger to the relevant GTM tag

1.  In your GTM container, navigate to **Tags** and click **New** — or open your existing Google Analytics tag to edit it.
    
2.  If creating a new tag, select **Universal Analytics** under **Choose tag type**.
    
3.  Under **Google Analytics Settings**, select **New Variable** and enter your GA Tracking ID in the **Tracking ID** field.
    
4.  Under **Triggering**, select the trigger you created in Step 1 — for example, **SP-Consent-Google-Analytics**.
    
5.  Click **Save** to create or update the tag.
    

![GTM Universal Analytics tag configuration showing SP-Consent-Google-Analytics trigger attached and Google Analytics Settings with Tracking ID field](https://pub-7bd19505838640d0a08ef1bd6ec3fb9b.r2.dev/articles/588fde551e88d89e5ab5-90291ed55a9f.webp)

### Step 3: Publish your GTM container

Click **Submit** then **Publish** to push your updated tag configuration live to your website.

**Note:** If any of your GTM tags use **multiple triggers**, additional configuration is needed to ensure correct consent-based blocking. See the guide on [blocking cookies with multiple GTM triggers](https://support.secureprivacy.ai/article/block-cookies-in-complex-gtm-triggers--consentbased-tagging/) for full instructions.

## Frequently Asked Questions

### Where do I find the correct plugin name to use in the sp-consent event?

The plugin name must exactly match the service name shown in your Secure Privacy account under **Classification** in the Scan Report. Navigate to your Secure Privacy dashboard, open the Classification tab for your domain, and copy the service name exactly as it appears — including capitalization and spacing.

### Do I need to create a separate trigger for every plugin I want to block?

Yes. Each plugin or service requires its own `sp-consent` custom event trigger in GTM — one trigger per service. Once the trigger is created, attach it to the corresponding tag in your GTM container.

### What happens if I use the wrong plugin name in the event trigger?

If the plugin name in your GTM custom event trigger does not exactly match the service name in your Secure Privacy Classification tab, the consent event will not fire correctly and the tag may load without consent — creating a compliance gap. Always copy the service name directly from the Classification tab rather than typing it manually.

## See Also

-   [How to Block Cookies with Multiple GTM Triggers](https://support.secureprivacy.ai/article/block-cookies-in-complex-gtm-triggers--consentbased-tagging/)
    
-   [How to Implement Secure Privacy with Google Tag Manager](https://support.secureprivacy.ai/article/how-to-install-secure-privacy-with-google-tag-manager-gtm/)
    
-   [Implementing Google Consent Mode Using GTM Template](https://support.secureprivacy.ai/article/implementing-google-consent-mode-advanced-using-google-tag-manager-community-template/)
