Integrating GCM v2 with Magento using CookieYes GTM Template

Last updated on December 14, 2024

Welcome to our detailed guide on integrating Google Consent Mode v2 with Magento using CookieYes. This tutorial provides a step-by-step walkthrough to help you set up GCM v2 on your Magento website, ensuring smooth operation and compliance with privacy regulations.

Note

To integrate GCM, a Magento website with admin access is required.

Setup CookieYes Account

For New Users:

  1. Create a CookieYes Account:
    Create a CookieYes account using your Magento website’s URL.
  2. Customise Your Cookie Banner:
    • Select your Banner Language.
    • Choose a Layout and Colour that suits your website design.
    • Click Next Step to proceed.
  3. Choose Installation Method:
    On the setup screen, select Install with Google Tag Manager as your installation method.
install banner

You can customise the cookie banner according to your website’s requirements.

For Existing Users:

  1. Log in to CookieYes:
    Log in to your CookieYes account using your existing credentials.
  2. Remove the CookieYes Script:
    Ensure you remove the existing CookieYes script from your website.
  3. Ensure Google Consent Mode is enabled.
    By default, the Basic Consent Mode feature is enabled. If you have previously disabled it, follow these steps to turn it back on:
    • Navigate to CookieYes Dashboard > Advanced Settings.
    • In Advanced Settings, toggle the button (to the right) labelled “Support GCM“ to enable the Basic Consent Mode.
support gcm

Setting Up the CookieYes GTM Template

Step 1: Create an Account

  1. Create a GTM account and set up a container.

    create container

Step 2: Add CookieYes CMP Template

  1. In the container dashboard, Click Tags from the left sidebar, and then New as shown.

    add new tag
  2. First, click on Tag Configuration > Discover more tag types in the Community Template Gallery, and then search for CookieYes CMP. Alternatively, you can get the template from this link. Alternatively, you can access the template directly using this link.
  3. Select the CookieYes CMP template and click Add to workspace Add.

    Add to workspace

Step 3: Configure CookieYes Tag

tag configuration

Insert the CookieYes Website Key

For New User:

  1. Head to the CookieYes setup screen and locate the Website Key.
  2. Click the Copy key button to copy the Website Key to your clipboard.

    copy key
  3. In GTM, paste the copied key into this field labelled Website Key.

For Existing User

  1. Head back to the CookieYes account.
  2. Go to Advanced Settings and click Get Installation Code.

    Advanced Setting
  3. In the modal, click Install with Google Tag Manager > Copy code.

    Copy code from advance settings
  4. In the GTM account, paste the copied key into this field labelled Website Key.

Set Default Consent Settings

  • Click Add Setting.
  • Select Enabled/Disabled from the drop-down for each cookie category based on your requirements.
  • Set the Region by entering the ISO-standardized (ISO 3166-2) codes for the regions you intend to geo-target. If you do not want to geo-target specific regions, enter All in the Regions field. Refer to the ISO 3166-2 standard for appropriate region codes.
  • Click Add.

    default consent settings

Set the trigger

  • Choose Consent Initialisation – All Pages as the firing trigger. This ensures the tag activates before any other tags.

    trigger conf
  • Click Save.

Step 4: Publish the Container

Click Submit and Publish to Publish your Container version.

Integrate GCM in Magento

  1. In the Magento Admin Dashboard, navigate to Content > Configuration on the left sidebar.

    content configuration
  2. This will take you to the Design Configuration page. At this point, you can either select a specific store view to add the code or choose Global to apply it across all store views.Now, click Edit to continue.


    edit
  3. Head back to the Google Tag Manager Account and then Click the Container ID. Copy the <script>.

    script
  4. Scroll down to the ‘Other Settings’, click on the HTML Head and add the installation code in the Scripts and Style Sheets field and click on Save Configuration.

    html head
  5. Head to the Google Tag Manager Account and copy the <noscript>.
  6. In ‘Other Settings’, click on the Footer and add the installation code in the Miscellaneous HTML and click on Save Configuration.

    footer
  7. To enable the installation code you added, flush the Magento cache.

    To flush the cache on your Magento website, first navigate to Systems > Cache Management, and then click on Flush Magento Cache.



    cler cache

Verify GCM Integration

For both new and existing users, follow these steps to verify GCM integration on your website:

  1. If you are a new user, first verify the cookie banner installation:
    • Go to the CookieYes setup screen and click Verify.
    • You will see the message: “You have successfully implemented a cookie banner on your site!”
verify gcm

After verifying the banner or if you’re an existing user, proceed to verify GCM:

  • Navigate to Advanced Settings in the CookieYes Dashboard.
  • Scroll to the Google Consent Mode (GCM) section.
  • Click the Check Now button against Check GCM status. If the configuration is correct, you will see a success message stating, ‘No error detected’.
verify gtm

To further confirm the setup is correct, follow the steps in our Verification Documentation

Enabling Advanced Consent Mode in GCM

To Advance Consent Mode,

  1. Navigate to Advanced Settings in the CookieYes Dashboard.
  2. To set up Advanced Consent Mode in GCM, toggle the button (to the right) labelled Allow Google tags to fire before consent.

    advanced gcm
  3. Return to your GTM account, click Submit, and then Publish to reflect the change on your website.

Conclusion

By following these steps, you will successfully integrate Google Consent Mode with your Magento website using CookieYes CMP. Once the integration is complete, you can perform a website scan directly from the CookieYes Dashboard and explore additional customisations and features.

For further assistance, our dedicated GCM support team are here to assist you.

Have more questions?

Reach out to us and we'll answer them.

Contact us