Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers

GDPR
Last updated: November 17, 2022 | by son_m2
TCF compliance guide for MonetizeMore publishers

This post was most recently updated on November 17th, 2022

Effective October 15, 2020 – Ad providers will support the TCF2.0 initiative and could stop bidding for EU users on sites where consent signals are not detected. Therefore, all publishers must be TCF2.0 compliant or expect a drop in ad revenues. Read Google’s help center article here.

Read our FAQ’s here:
https://www.monetizemore.com/blog/frequently-asked-questions-gdpr-and-eprivacy-directive/

If you have any hardcoded codes like AdSense, Ad Exchange, GAM header & body, or Google Analytics, EU users must explicitly give consent before any of these tags, that collect personal information, can serve.

If you work with MonetizeMore, here is a quick guide on how you can convert your onpage codes to be TCF2.0 compliant:

Check your source code if you still have this tag:

<script src=”https://cdn.pubguru.com/pg.js” />

If yes, disable or remove it! Then proceed below depending on which onpage codes you’re running:

AdSense

 

Sample raw code (non-TCF2.0 compliant):

<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”</script>
<!– adsense_320x50 –>
<ins class=”adsbygoogle”
style=”display:inline-block;width:320px;height:50px”
data-ad-client=”ca-pub-12345″
data-ad-slot=”123″></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

TCF2.0 compliant code:

Can go either in the Header or Body (will be provided to you by MonetizeMore):

<script src=”//m2d.m2.ai/PUBDOMAIN.js” async></script>

Body:

<ins class=”adsbygoogle”
style=”display:inline-block;width:320px;height:50px”
data-ad-client=”ca-pub-12345″
data-ad-slot=”123″></ins>

What changed in the code to make it compliant?

Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers MonitizeMore

AdSense Auto-Ads

Sample raw code (non-TCF2.0 compliant):

<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script type=”text/javascript”>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client : “ca-pub-XXXXXXXXXXXXXXX”,
enable_page_level_ads : true
});
</script>

TCF2.0 compliant code:

<script type=”text/javascript”>
window.pg=window.pg||[];pg.atq=pg.atq||[];
pg.atq.push(function() {
// Google Adsense Auto ads
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: “ca-pub-XXXXXXXXXXXXXXXX”,
enable_page_level_ads: true
});
});
</script>
<script src=”//m2d.m2.ai/PUBDOMAIN.js” async></script>

What changed in the code to make it compliant?

Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers MonitizeMore

Ad Exchange

 

Sample raw code (non-TCF2.0 compliant):

<script type=”text/javascript”>
google_ad_client = “ca-pub-12345”;
/* sample.com_desktop_300X250 */
google_ad_slot = “123”;
google_ad_width = 300;
google_ad_height = 250;
</script>
<script type=”text/javascript” src=”//pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

TCF2.0 compliant code:

Can go either in the Header or Body (will be provided to you by MonetizeMore):

<script src=”//m2d.m2.ai/PUBDOMAIN.js” async></script>

Body:

<ins class=”adsbygoogle”
style=”display:inline-block;width:300px;height:250px”
data-ad-client=”ca-pub-12345″
data-ad-slot=”123″></ins>

What changed in the code to make it compliant?

Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers MonitizeMore

 

Google Ad Manager

 

Sample raw code (non-TCF2.0 compliant):

Head:

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {

googletag.defineSlot(‘/55555/ad1_sample’, [[728, 90], [300, 250]], ‘div-gpt-ad-22222-0’).addService(googletag.pubads());

googletag.defineSlot(‘/55555/ad2_sample’, [[970, 90], [728, 90]], ‘div-gpt-ad-33333-0’).addService(googletag.pubads()); 

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

Body:

<div id=’div-gpt-ad-22222-0′>
<script>
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-22222-0’); });
</script>
</div>

<div id=’div-gpt-ad-33333-0′>
<script>
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-33333-0’); });
</script>
</div>

TCF2.0 compliant code:

Anything ad-related goes into pg.atq function if the publisher is running Traffic Cop (block).

Head:

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
window.pg=window.pg||[];pg.atq=pg.atq||[]; // build consent queue
pg.atq.push(function() {
//GAM Tag
googletag.cmd.push(function () {

googletag.defineSlot(‘/12345/ad1_sample’, [[728, 90], [300, 250]], ‘div-gpt-ad-22222-0’).addService(googletag.pubads());

googletag.defineSlot(‘/12345/ad2_sample’, [[970, 90], [728, 90]], ‘div-gpt-ad-33333-0’).addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
});
</script>
<script src=”//m2d.m2.ai/pghb.domain.com.js” async></script>

Body:

<div id=’div-gpt-ad-22222-0′>
<script>
pg.atq.push(function() {window.googletag.cmd.push(function() {googletag.display(‘div-gpt-ad-22222-0’);})});
</script>
</div>

<div id=’div-gpt-ad-33333-0′>
<script>
pg.atq.push(function() {window.googletag.cmd.push(function() {googletag.display(‘div-gpt-ad-33333-0’);})});
</script>
</div>

What changed in the code to make it compliant?

Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers MonitizeMore

 

Google Analytics

Sample raw code (non-TCF2.0 compliant):

<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-12345-1″</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘UA-12345-1’);
</script>

TCF2.0 compliant code:

<script>
window.pg=window.pg||[];pg.acq=pg.acq||[]; // build consent queue
pg.acq.push(function() {
// Global site tag (gtag.js)
pg.loadJS(“https://www.googletagmanager.com/gtag/js?id=UA-12345-1”);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘UA-12345-1’);
});
</script>

What changed in the code to make it compliant?

Avoid penalties by implementing a consent popup for GDPR compliance. Transparency and Consent Framework 2.0 (TCF2.0) Compliance guide for MonetizeMore Publishers MonitizeMore

GAM + Google Analytics

TCF2.0 compliant code:

Head:
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
window.pg=window.pg||[];pg.acq=pg.acq||[];
pg.acq.push(function() {
//GAM Tag
googletag.cmd.push(function () {
googletag.defineSlot(‘/55555/sample_ad1’, [[728, 90], [300, 250]], ‘div-gpt-ad-22222-0’).addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

//Google Analytics
pg.loadJS(“https://www.googletagmanager.com/gtag/js?id=UA-147580335-1″); window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘UA-147580335-1’);
});
</script>
<script src=”//m2d.m2.ai/PUBDOMAIN.js” async></script>

Body:
<div id=’div-gpt-ad-22222-0′>
<script>

pg.acq.push(function() {window.googletag.cmd.push(function() {googletag.display(‘div-gpt-ad-22222-0’);})});
</script>
<div>

Google Analytics, Facebook Pixels or any user tracking code needs to go inside pg.acq function in all scenarios whether the publisher is running TC or not.

How to properly test PubGuru DataGuard:

https://www.monetizemore.com/blog/how-properly-test-pubguru-dataguard-gdpr-consent-management/

 

Recommended Reading

best_guide_mobile_banner_ads
Blog
February 21, 2025

The ONLY Mobile Banner Ads you need to Use in 2025 [Make More Ad Revenue with these!]

Read More
safeguard-against-google-terminations-clawbacks
Ad Optimization
February 17, 2025

Safeguard Against Google Terminations and Clawbacks: Webinar Recap

Read More
what-are-parallax-ads
Blog
February 14, 2025

The Parallax Ads Hype: Is this 2025’s best ad format?

Read More

Trusted by 1,500+ publishers worldwide

10X your ad revenue with our award-winning solutions.

Let's Talk

Close

Ready to 10X your ad revenue with the #1 ad management partner?

Start Now