# Set Up Consent Mode

> Set up consent with Google Tag Manager, Shopify Customer Privacy, or an AnyTrack-enabled CMP integration, then verify that each tag receives the expected state.

How consent reaches your tags depends on where those tags are managed. Choose
the setup that matches Google Tag Manager, Shopify, or a direct consent
management platform (CMP) integration.

<Callout icon="ℹ️" theme="info">
**Your CMP remains the source of truth.** It should collect the visitor's choice
and control the third-party tags on your website. Match each signal to the
purpose defined by your CMP and consent policy.
</Callout>

<Prerequisites
  title="Before you begin"
  items={[
    { label: "Your CMP or Shopify banner provides saved consent choices", done: true },
    { label: "You know which tags are managed in GTM and which are managed by AnyTrack", done: true },
    { label: "You can test the setup in your CMP, GTM, or Shopify environment", done: true },
  ]}
/>

## Choose Your Consent Setup

<Tabs>
  <Tab title="Google Tag Manager">
    Use this path when the AnyTrack Tracking Tag and your third-party tags are
    managed in Google Tag Manager.

    <Steps>
      <Step number={1} title="Set the GTM consent defaults">
        Configure your CMP to set consent defaults using the **Consent
        Initialization - All Pages** trigger.
      </Step>

      <Step number={2} title="Install the AnyTrack template">
        Install the [AnyTrack GTM template](/docs/google-tag-manager) from the
        GTM Community Template Gallery and enter your AnyTrack Property ID.
      </Step>

      <Step number={3} title="Set the AnyTrack trigger">
        Set the AnyTrack tag to trigger on **All Pages**, after the CMP sets
        the consent defaults.
      </Step>

      <Step number={4} title="Configure consent checks for your tags">
        Configure the consent checks required by each Google or third-party tag
        managed in GTM.
      </Step>
    </Steps>

    The AnyTrack GTM template reads all four Consent Mode v2 types, sends a full
    consent snapshot to AnyTrack, and listens for later changes. Tags managed in
    GTM follow the consent settings configured in GTM.

    <Callout icon="ℹ️" theme="info">
    To pass the same GTM consent state to Google or Microsoft tags loaded by
    AnyTrack, request AnyTrack Consent Mode access as described in the **Direct
    CMP** tab.
    </Callout>

    <Steps title="How consent flows with Google Tag Manager"
      subtitle="From the visitor choice to a full consent snapshot in AnyTrack"
      variant="flow">
      <Step number={1} phase="visitor" title="Visitor makes a consent choice" code="Consent Initialization - All Pages">
        Your CMP sets the consent defaults, then records the visitor choice as
        a consent update in GTM.
      </Step>
      <Step number={2} phase="anytrack" title="AnyTrack template reads the consent state" code="ad_storage / analytics_storage / ad_user_data / ad_personalization">
        The AnyTrack GTM template reads all four Consent Mode v2 signals and
        listens for later changes.
      </Step>
      <Step number={3} phase="result" title="Each tag receives its consent state">
        The template sends the full consent snapshot to AnyTrack. Tags managed
        in GTM follow the consent checks configured in GTM.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Shopify">
    <Callout icon="⚠️" theme="warning">
    **Feature access required.** Shopify consent sync is available only for
    selected properties. Open the support chat from your AnyTrack dashboard and
    request **Shopify consent sync** for your Property. See
    [Contact support](/docs/contact-support).
    </Callout>

    Use this path when your consent banner saves choices through the Shopify
    Customer Privacy API.

    <Steps>
      <Step number={1} title="Configure the consent banner">
        Configure a Shopify-compatible consent banner.
      </Step>

      <Step number={2} title="Request Shopify consent sync">
        Ask AnyTrack support to enable Shopify consent sync for the Property.
      </Step>

      <Step number={3} title="Test the consent flow">
        Test the banner after support confirms that the feature is enabled.
      </Step>
    </Steps>

    AnyTrack then reads the saved Shopify choice and listens for banner updates.
    No custom <code>setConsent</code> callback is required.

    - Shopify **marketing** controls <code>ad_storage</code> and
      <code>ad_personalization</code>.
    - Shopify **analytics** controls <code>analytics_storage</code>.
    - <code>ad_user_data</code> is granted only when both marketing and
      sale-of-data consent are granted.

    <Steps title="How consent flows with Shopify"
      subtitle="From the banner choice to the tags AnyTrack loads"
      variant="flow">
      <Step number={1} phase="visitor" title="Visitor saves a choice in the banner" code="Shopify Customer Privacy API">
        The consent banner stores the visitor choice in Shopify.
      </Step>
      <Step number={2} phase="anytrack" title="AnyTrack reads the saved choice">
        With Shopify consent sync enabled for the Property, AnyTrack reads the
        stored choice and listens for banner updates.
      </Step>
      <Step number={3} phase="result" title="Signals reach AnyTrack-loaded tags" code="marketing / analytics / sale of data">
        AnyTrack maps the Shopify categories to the four consent signals and
        applies them to the tags it loads.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Direct CMP">
    <Callout icon="⚠️" theme="warning">
    **Feature access required.** Direct CMP consent delivery is not enabled by default.
    Open the support chat from your AnyTrack dashboard and request **Consent
    Mode** for your Property before implementing this setup. See
    [Contact support](/docs/contact-support).
    </Callout>

    Use this path when the CMP is installed directly on your website and you
    want AnyTrack-managed Google or Microsoft tags to receive its choices.

    <Steps>
      <Step number={1} title="Configure the default state">
        After support enables the feature, open **Property Settings → Consent
        Mode (beta)** and configure the default state for each signal.
      </Step>

      <Step number={2} title="Map the CMP categories">
        Map the CMP categories to the four signals listed below.
      </Step>

      <Step number={3} title="Send consent updates">
        Call <code>setConsent</code> after the CMP restores a saved choice and
        whenever the visitor accepts, rejects, or changes consent:

        ```js
        AnyTrack('setConsent', {
          ad_storage: marketingStorageAllowed ? 'granted' : 'denied',
          analytics_storage: analyticsStorageAllowed ? 'granted' : 'denied',
          ad_user_data: advertisingDataAllowed ? 'granted' : 'denied',
          ad_personalization: personalizationAllowed ? 'granted' : 'denied',
        });
        ```

        Replace the example variables with the values returned by your CMP.
        Send all four fields in the first call so the initial state is complete.
      </Step>
    </Steps>

    <Steps title="How consent flows with a direct CMP"
      subtitle="From the CMP choice to the tags AnyTrack loads"
      variant="flow">
      <Step number={1} phase="visitor" title="CMP collects the visitor choice">
        The CMP shows the banner, stores the choice, and restores it on later
        visits.
      </Step>
      <Step number={2} phase="update" title="Your site sends the consent state" code="AnyTrack('setConsent', ...)">
        Your setConsent call sends the four signals to AnyTrack after each
        restore or change.
      </Step>
      <Step number={3} phase="result" title="AnyTrack applies the signals">
        Google and Microsoft tags loaded by AnyTrack receive the current
        consent state.
      </Step>
    </Steps>
  </Tab>
</Tabs>

<HowToSchema
  name="Set up Consent Mode in AnyTrack"
  description="Choose and configure the correct consent setup for Google Tag Manager, Shopify, or a direct CMP integration."
  steps={[
    {
      name: "Choose the consent setup",
      text: "Choose Google Tag Manager when it manages your tags, Shopify when the banner uses Shopify Customer Privacy, or Direct CMP when AnyTrack-managed tags must receive the CMP choice.",
      url: "/docs/consent-mode#choose-your-consent-setup",
    },
    {
      name: "Configure the selected consent source",
      text: "Follow only the steps for the selected setup: establish consent defaults, install or enable the required AnyTrack integration, and send or synchronize consent updates.",
      url: "/docs/consent-mode#choose-your-consent-setup",
    },
    {
      name: "Map consent signals",
      text: "Map the CMP or Shopify purposes to ad_storage, analytics_storage, ad_user_data, and ad_personalization according to the consent policy.",
      url: "/docs/consent-mode#consent-signals-and-destinations",
    },
    {
      name: "Verify the consent flow",
      text: "Test the initial state, each relevant accept and reject choice, and a returning visit to confirm the saved choice reaches the expected tags.",
      url: "/docs/consent-mode#verify-the-setup",
    },
  ]}
/>

## Consent Signals and Destinations

Map CMP categories by purpose, not only by their labels. One "Marketing" category
does not always cover every advertising purpose.

<Table align={["left", "left"]}>
  <thead>
    <tr>
      <th>Signal</th>
      <th>Purpose to map in your CMP</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>ad_storage</code></td>
      <td>Advertising or marketing storage</td>
    </tr>
    <tr>
      <td><code>analytics_storage</code></td>
      <td>Analytics storage</td>
    </tr>
    <tr>
      <td><code>ad_user_data</code></td>
      <td>Sending user data for advertising</td>
    </tr>
    <tr>
      <td><code>ad_personalization</code></td>
      <td>Personalized advertising and remarketing</td>
    </tr>
  </tbody>
</Table>

### Tag Compatibility

This table applies to tags loaded by AnyTrack.

<Table align={["left", "left", "left"]}>
  <thead>
    <tr>
      <th>Tag</th>
      <th>Status</th>
      <th>Consent handling</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Google Ads</td>
      <td>✅ Supported<sup>*</sup></td>
      <td>Receives all four Consent Mode v2 signals</td>
    </tr>
    <tr>
      <td>Google Analytics 4</td>
      <td>✅ Supported<sup>*</sup></td>
      <td>Receives all four Consent Mode v2 signals</td>
    </tr>
    <tr>
      <td>Microsoft Advertising UET</td>
      <td>✅ Supported<sup>*</sup></td>
      <td>Receives <code>ad_storage</code></td>
    </tr>
    <tr>
      <td>Meta Pixel</td>
      <td>🕒 Coming soon</td>
      <td>Manage consent through your CMP or GTM</td>
    </tr>
    <tr>
      <td>TikTok Pixel</td>
      <td>🕒 Coming soon</td>
      <td>Manage consent through your CMP or GTM</td>
    </tr>
    <tr>
      <td>Outbrain Pixel</td>
      <td>🕒 Coming soon</td>
      <td>Manage consent through your CMP or GTM</td>
    </tr>
    <tr>
      <td>Taboola Pixel</td>
      <td>🕒 Coming soon</td>
      <td>Manage consent through your CMP or GTM</td>
    </tr>
  </tbody>
</Table>

<sup>*</sup> For tags loaded by AnyTrack, Shopify consent sync or AnyTrack
Consent Mode must be enabled for the Property. Tags installed in GTM use the
consent state and consent checks configured in GTM and do not require AnyTrack
Consent Mode access.

## Verify the Setup

<Steps>
  <Step number={1} title="Check the initial state">
    Open a private browser window before interacting with the banner. Confirm
    that the defaults configured in GTM, Shopify, or AnyTrack are active.
  </Step>

  <Step number={2} title="Test every relevant choice">
    Accept and reject each CMP category. Confirm that GTM or the enabled AnyTrack
    integration receives the expected four-signal state after each choice.
  </Step>

  <Step number={3} title="Test a returning visitor">
    Reload the page and confirm that the CMP or Shopify restores the saved choice.
    Use Google Tag Assistant or Microsoft UET Tag Helper for the relevant tags.
  </Step>
</Steps>

<Callout icon="✅" theme="success">
The setup is complete when the initial state is applied before a choice, each
CMP action produces the expected update, and the saved choice is restored after
a reload.
</Callout>

## Related Guides

- [Install the AnyTrack Tracking Tag](/docs/install-anytrack-tag)
- [Install AnyTrack with Google Tag Manager](/docs/google-tag-manager)
- [Connect Google Ads](/docs/google-ads)
- [Connect Microsoft Ads](/docs/microsoft-ads)
- [Set up the Shopify integration](/docs/shopify)
- [Google Consent Mode](https://developers.google.com/tag-platform/security/concepts/consent-mode)
- [Microsoft UET Consent Mode](https://learn.microsoft.com/en-us/advertising/msa-help/hlp_ba_conc_uet_consent)

<FaqAccordion
  title="Consent Mode FAQs"
  lastReviewed="2026-07-28"
  items={[
    {
      question: "Does AnyTrack configure consent for every third-party tag?",
      answer: "No. Tags managed in GTM follow their GTM consent settings. When the feature is enabled, AnyTrack applies the supported signals to Google and Microsoft tags managed by AnyTrack. Configure all other third-party tags in your CMP or tag manager."
    },
    {
      question: "Can I send only the field that changed?",
      answer: "For an enabled direct CMP integration, later <code>setConsent</code> calls can contain only changed fields. Send all four fields in the first call to establish a complete state."
    },
    {
      question: "How do I request Shopify or direct CMP consent access?",
      answer: "Open the support chat from the AnyTrack dashboard and provide your Property name, Property ID, platform, CMP, and the consent setup you need enabled."
    },
    {
      question: "Does Consent Mode replace my CMP?",
      answer: "No. Your CMP collects and stores the visitor's choice. AnyTrack uses that choice to update supported connected tags."
    }
  ]}
/>
