CMP web implementation via Google Tag Manager (GTM)

  Note: It is not recommended to implement Sourcepoint's CMP via a tag manager as it can impact the message loading performance. Additionally, Sourcepoint cannot guarantee that actions configured within our event callbacks are available before the next GTM trigger fires. 

In this article, we will cover how to implement the Sourcepoint CMP via Google Tag Manager on your web property. 

Install GTM on property

Follow the directions in your Google Tag Manager account to install Google Tag Manager on your property. Installing GTM on your property requires adding a code snippet to your <head> tag and a code snippet to your <body> tag. 


Configure GTM container

Configure a container in your Google Tag Manager account to manage the consent action value. 

 Google Tag Manager Documentation

We will use the Custom HTML tag type to insert the Sourcepoint implementation script that we would normally use if implementing directly onto a webpage. 

Screenshot 2023-08-17 at 3.25.31 PM.png

<script> function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){for(var t,e,o=[],n=window,r=n;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(;r=n.parent}t||(function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");"display:none","__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof,o={};if(e)try{o=JSON.parse(}catch(t){}else;var n="object"===_typeof(o)?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))}();</script> 
    window._sp_queue = [];
    window._sp_ = {
        config: {
            accountId: 0000,
            baseEndpoint: '',
            propertyHref: '', 
            gdpr: { },
            events: {
                onMessageChoiceSelect: function() {
                    console.log('[event] onMessageChoiceSelect', arguments);
                onMessageReady: function() {
                    console.log('[event] onMessageReady', arguments);
                onMessageChoiceError: function() {
                    console.log('[event] onMessageChoiceError', arguments);
                onPrivacyManagerAction: function() {
                    console.log('[event] onPrivacyManagerAction', arguments);
                onPMCancel: function() {
                    console.log('[event] onPMCancel', arguments);
                onMessageReceiveData: function() {
                    console.log('[event] onMessageReceiveData', arguments);
                onSPPMObjectReady: function() {
                    console.log('[event] onSPPMObjectReady', arguments);
                onConsentReady: function (consentUUID, euconsent) {
                    console.log('[event] onConsentReady', arguments);
                onError: function() {
                    console.log('[event] onError', arguments);

Your tag should be triggered using a Consent Initialization - All Pages trigger type. This trigger type is designed to ensure that consent settings are honored before any other triggers fire and is used for tags that set or update the user consent state for your site.

Screenshot 2023-08-22 at 8.49.02 AM.png

Click Save when finished.

Publish GTM container

Once the GTM container is configured properly, click Submit and follow the prompts to publish your configuration. 


Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.