Forum Moderators: martinibuster

Message Too Old, No Replies

Personalization settings in ads tags

Do they override account settings?

         

surfgatinho

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

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



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...

bgweb

10:34 am on May 24, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



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;

surfgatinho

11:14 am on Jun 5, 2018 (gmt 0)

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



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...

bgweb

2:30 pm on Jun 5, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



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.