Welcome to WebmasterWorld Guest from 54.80.198.173

Forum Moderators: incrediBILL & martinibuster

Personalization settings in ads tags

Do they override account settings?

     
10:49 pm on May 14, 2018 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 17, 2003
posts:691
votes: 21


I have been looking at the personalization settings in Google’s publisher ad tags as specified here: [support.google.com...]

I'm not quite 100% where and how you would call these conditionally but they would be really useful for testing. I suppose something like:
<script>
if(something){
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1
}
else{
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0
}
</script>

instead of
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


Also, I am wondering, if you set not to serve personalized ads to EU users in your Adsense account, will this override that. I kind of hope this is the case so I can set that up and just play about with this code...
10:34 am on May 24, 2018 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Mar 29, 2018
posts: 72
votes: 10


Did you make any progress with this? I am finding that nothing is displayed if I set:

(adsbygoogle = window.adsbygoogle || []).requestNonPersonalizedAds = 1;
(adsbygoogle = window.adsbygoogle || []).push({});

However ads are displayed if I do this:

(adsbygoogle = window.adsbygoogle || []).push({}).requestNonPersonalizedAds = 1;
11:14 am on June 5, 2018 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 17, 2003
posts: 691
votes: 21


Still not sure how this is supposed to work. I've set my Adsense not to show personalized ads in the EU and at the moment I'm trying something like this in the head:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1;
if(consent){
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0;
console.log('Consent');
}
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0;
</script>


Haven't really convincingly tested whether it does what I want it to. Also does this override settings in the Adsense admin for not showing personalized ads? And does it then show third party ads too?

I'm thinking I might try it the other way round and allow personalized ads in the admin and then programmatically stop them...
2:30 pm on June 5, 2018 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Mar 29, 2018
posts: 72
votes: 10


On the else branch you can use your normal code without calling the new method. On the if branch I think you can add in the new line of code before the one with the push method, but remember the ; at the end. That pattern is working for me.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members