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?
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?
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?
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?
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?
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/