Welcome to WebmasterWorld Guest from 100.26.182.28

Forum Moderators: martinibuster

Message Too Old, No Replies

Convert regular AdSense units into responsive ones in an easy way

Leaving the 'data-ad-client' and 'data-ad-slot' information

     
4:29 pm on Feb 17, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 5, 2004
posts:138
votes: 0


Hi

I am changing the HTML design of my website, converting all the pages into responsive ones. I am also planning the conversion of the AdSense units of the pages into responsive ones, and wondered if the transformation is as easy as the following.

This is the piece of code of one of the current AdSense units:

<script type="text/javascript"><!--
google_ad_client = "ca-pub-XXXXXXXXXXXXXXX";
google_ad_slot = "YYYYYYY";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="">
</script>


Would it be as easy as adding the 'data-ad-format', removing the 'google_ad_width' and 'google_ad_height', and leaving the information of 'data-ad-client' and 'data-ad-slot'?

<script async src="//"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXXXXXXX"
data-ad-slot="YYYYYYY"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

I mean, I do not want to remove my current custom channels and create new ones, and wondered if they would work with a new responsive design.

Thank you very much.
5:02 pm on Feb 17, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member netmeg is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2005
posts:13012
votes: 222


Interesting question, and I don't know. I'm not sure if you *must* create the new ad units in the User Interface, or if you can just effect changes on your own. That's probably a question for AdSense support, if you qualify. I'd be interested in hearing if you get an answer.

(Your channels should work with any ad you assign them to, but whether or not you can assign them outside of the console I don't know. It does create a unique Ad ID, so maybe not)
5:08 pm on Feb 17, 2015 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 30, 2004
posts:129
votes: 0


I can't see the reporting working right without first creating the ad in the console because it will be getting clicks on ads it doesn't know about. So i agree with nutmeg.
6:13 pm on Feb 17, 2015 (gmt 0)

Senior Member from US 

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

joined:Apr 26, 2005
posts:2294
votes: 616


There is also something in the TOS about not fiddling with the ad code. I have done so in the past but only with advance permission and then only because my software was adding extra information to the code. As Netmeg says, check with support.
6:54 pm on Feb 17, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member netmeg is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2005
posts:13012
votes: 222


nutmeg


ahem.

There is also something in the TOS about not fiddling with the ad code


Yea. I'd have to look it up - they've loosened up on that a bit, but I think you're still only supposed to adjust the CSS, and if you have more than one async or responsive ad on a page, you can remove that last <script> from all the ads after the first one.
10:33 pm on Feb 17, 2015 (gmt 0)

Senior Member from US 

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

joined:Apr 26, 2005
posts:2294
votes: 616


Nevermind.
3:15 pm on Feb 18, 2015 (gmt 0)

Senior Member

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

joined:Nov 6, 2005
posts: 2853
votes: 33


nutmeg


ahem!




There must be an inergallatic glitch in that Internet cloud thingy.



FarmBoy
4:11 pm on Feb 18, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 27, 2003
posts:1600
votes: 0


... if you have more than one async or responsive ad on a page, you can remove that last <script> from all the ads after the first one.


Is this why I can't make any other ads responsive? I've been trying forever to change all my ads to responsive, but got only 1 to do it, and not the others.

Thanks for the tip!
10:28 pm on Feb 18, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member netmeg is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2005
posts:13012
votes: 222


Well it might have something to do with how you're implementing it. I use Google Tag Manager, and I actually moved the script from *all* the ads and just serve it once in the GTM - mostly for performance reasons. But having the script on each ad unit should still work, I'd think.
9:22 pm on Feb 19, 2015 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member redbar is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Oct 14, 2013
posts:3284
votes: 522


you can remove that last <script> from all the ads after the first one.


I've never heard of that before and I have a lot of pages with two responsive ads and zero issues insofar as I am aware.
9:58 pm on Feb 19, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member netmeg is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 30, 2005
posts:13012
votes: 222


Right, it shouldn't prevent ads from showing. You only need to have *one* call to that script though, and under heavy traffic I want to optimize all that I can, so I took the script off all the ads, and call it only once with an include on the page (or rather, with GTM)

If you don't have it at least once though, your ads won't show.
11:08 am on Feb 20, 2015 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member redbar is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Oct 14, 2013
posts:3284
votes: 522


Ah, ok, I also serve via an include, I'll bear this in mind if I ever get back to heavy traffic numbers....that's very doubtful!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members