Skip to content

Acquia Optimize

Google Tag Manager deployment

Setup

This article gives one example of how to add the script to Google Tag Manager. For any issues with Google Tag Manager, contact Google Support.

This section gives instructions on how to set up Google Tag Manager. For installation, see Setup and Install Tag Manager for instructions from Google on how to install Tag Manager.

  1. Log in to Google Tag Manager and access the account and workspace for the website.

  2. Click New Tag/Add a new tag. The tag creation page opens.

  3. In the name field, replace the text Untitled Tag with a name for the new tag.

  4. Click in the Tag Configuration section. The tag type list opens.

  5. Locate and select Custom HTML.

  6. The Tag Configuration pane opens. Paste the script into the Custom HTML section.

    For instructions, see the user guide article:
    Add the Script.

    <script type="text/javascript"> window._monsidoConsentManagerConfig = {
         token: "YOURTOKEN" 
    } 
    </script> 
    <script src="https://monsido-consent.com/v1/mcm.js" type="text/javascript">
  7. Click in the Triggering section. The Choose a trigger page opens.

  8. Click to select All Pages with type Page View.

  9. Click Save to save the tag and activate it.

Advanced instructions

This section gives instructions on how to set up advanced configurations in Google Tag Manager to use with Consent Manager.

Add Triggers for Consent Manager tags

This section gives instructions on how to create triggers in Google Tag Manager to use with Consent Manager.

Add the trigger in Google Tag Manager:

  1. Click Triggers on the menu on the left-hand side of the page. The Triggers page opens.

  2. Click New. The trigger configuration window opens.

  3. In the name field, type in a name (for example, "Consent Manager Marketing Consented").

  4. Click in the Trigger Configuration section. The Trigger Type menu opens.

  5. In the Other section, choose Custom Event.

    The Trigger Configuration window opens.

  6. In the Trigger Configuration window, in the Event name section, enter an event name, for example:

    cookie_consent_marketing
  7. Leave the other options set to the default value and then click Save.

  8. The dialog closes and the trigger is present in the list.

  9. Add a tag in Google Tag Manager for the trigger.

  • In Google Tag Manager, navigate to the Workspace Overview page.

  • Click Tags in the menu on the left side of the page. The Tags window opens.

  • Click New.

  • In the name field, type in a name (for example, "Marketing script").

  • Click in the Tag Configuration field.

  • Select Custom HTML in the tag types list.

    The Tag Configuration page opens.

  • In the HTML field, type in the script. For example:

    <script>
      //Marketing script requires that marketing cookie category consent is given
    </script>
  • Click Save. A dialog box opens with the message "No Triggers Selected".

  • Click Add Trigger and select the trigger that was just created.

  • Click Save. The tag creation window closes and the tag is on the list.

  • To create other types of triggers, replace cookie_consent_marketing with:

    • cookie_consent_all : All-purpose consent given

    • cookie_consent_essential : Essential consent given

    • cookie_consent_basic : Basic interactions and functionalities purpose consent given

    • cookie_consent_marketing : Marketing (targeting and advertising) purpose consent given

    • cookie_consent_analytics : Analytic purpose consent given

    • cookie_consent_personalisation : Personalization (Experience enhancement) consent given.

Add Triggers to Control Cookies

Google Tag Manager includes some features that determine how the tags behave in response to the end-user cookie consent choices.

Some tags can set cookies. In order for the Consent Manager solution to retain those tags, triggers need to be created and set on those tags. The trigger retains the tag until the user interacts with the banner, by opt-out or opt-in.

This section gives instructions on how to create triggers in Google Tag Manager to use with Consent Manager.

In Google Tag Manager:

  1. Click Triggers from the menu on the left side of the page. The Triggers page opens.

  2. Click New. The trigger configuration window opens.

  3. Type a name in the Name field (for example, "Monsido Consent Manager Marketing Consented").

  4. Click in the Trigger Configuration section. The Trigger Type menu opens.

  5. Choose Custom Event.

    The Trigger Configuration pane opens.

  6. Enter an event name, for example: cookie_consent_marketing.

  7. Leave the other options set to the default value.

  8. Click Save.

  9. The dialog closes and the trigger is present in the list.

To create other types of triggers, replace cookie_consent_marketing with:

  • cookie_consent_all : All-purpose consent given

  • cookie_consent_essential : Essential consent given

  • cookie_consent_basic : Basic interactions and functionalities purpose consent given

  • cookie_consent_marketing : Marketing (targeting and advertising) purpose consent given

  • cookie_consent_analytics : Analytic purpose consent given

  • cookie_consent_personalisation : Personalization (Experience enhancement) consent given

For more information, see the article:

Consent Manager Attributes.

Add Consent Checks to Tags (set triggers)

This section gives an example of how you can use Google Tag Manager to set up triggers for consent checks on tags.

  1. In Google Tag Manager, navigate to the Workspace Overview page.

  2. Click Tags in the menu on the left-hand side of the page. The Tags window opens.

  3. Select the tag that sets cookies.

  4. Scroll down into the Triggering section and click Edit (icon of a pencil) on the top right corner of the page.

    A new container opens.

  5. Select the trigger(s).

  6. Click Save. The tag creation window closes and the tag is on the list.

Exclude the Script on Specific Pages

This section gives instructions on how to exclude the script on specific pages with Google Tag Manager.

For example, if a trigger exception is set to "Page URL equals thankyou.html", the tag will never fire on the page "thankyou.html".

Tip: Use advanced Tag Sequencing settings to cause the tag to ignore its own triggers and instead fire as part of the sequence.

To remove a trigger from a tag configuration, or to create an exception:

  1. Click Tags in the menu on the left side of the page. The Tags window opens.

  2. Click the name of the tag to edit. The Tag configuration window opens.

  3. Select a trigger in the Triggering section.

    The Trigger configuration window opens.

  4. Click Edit (the pencil icon) to edit the trigger.

    • To add a trigger: Click Add (the plus sign icon) in the Firing Triggers section. The existing triggers list opens. Click to select a trigger from the list to add.

    • To remove a trigger, click Remove (a minus sign icon) on the same row as the trigger to remove in the Firing Triggers section.

    • To add a trigger exception, click on the link Add Exception. If any exceptions already exist, click Add (the plus sign icon). The existing triggers list opens. Click to select a trigger to exclude. The trigger is added to the Exceptions section on the Trigger Configuration page.

    • To remove a trigger exception, click Remove (a minus sign icon) on the same row as the trigger to remove in the Exceptions section.

How to opt out of tracking but keep Consent Manager

This question is concerning a setup where the tracking and compliance manager is deployed in a script via Google Tag Manager. This section gives instructions on how to opt out of statistics tracking when you use Consent Manager.

  1. Create two custom tags in Google Tag Manager.

    • One tag for the Statistics script

    • One tag for the Consent Manager script.

  2. Set both tags to run on all pages.

  3. Set a trigger on Statistics (for example, on Analytics.)

  4. Add the HTML script to the tag created in Google Tag Manager.

    1. Get the Statistics script:

      • From the dashboard, navigate to the script setup section.

        For more information, see the user guide article:

        Add the Script.

      • Select only Statistics. Configure the module if needed.

        For more information, see the user guide article:

        Statistics Feature Setup.

      • Add the HTML script to the tag created in Google Tag Manager.

    2. Get the Consent Manager script.

      • Return to the Acquia Optimize dashboard and navigate to the script setup section again.

        For more information, see the user guide article:

        Add the Script.

      • Select only Consent Manager. Configure the module if needed.

        For more information, see the user guide article:

        Consent Manager.

  5. Add the HTML script to the tag created in Google Tag Manager.

Additional Resources

For more information, see the user guide articles:

For instructions from Google on how to install Tag Manager, see:

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.