Welcome to WebmasterWorld Guest from 35.175.120.174

Forum Moderators: martinibuster

Message Too Old, No Replies

Matched Content Code for Desktop/Mobile

Responsive Matched Content Code Not Working

     
3:41 am on Feb 21, 2018 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 24, 2002
posts: 512
votes: 5


Hi,

The matched content code I've started to deploy on my site works with the following code:


<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-matched-content-rows-num="1"
data-matched-content-columns-num="1"
data-matched-content-ui-type="image_stacked"
data-ad-format="autorelaxed"
data-ad-client="ca-pub-myadid"
data-ad-slot="myadslot"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>



The code also works if I change any of the "content-rows-num" and "content-cols-num" to any other value. Thus, I could have 4/1, 3/3, etc...They all seem to work and I get nice looking ads.

The problem is, this code is going on a responsive site. Ideally, I'd like to have it go 1 row/4 columns on mobile and then deploy 2x2 on desktop.

So I used the code direct off the Adsense help page (https://support.google.com/adsense/answer/7533385?hl=en) and, nothing. I get a blank spot.

This is the code I use for responsive pages:


<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-matched-content-rows-num="4,2"
data-matched-content-columns-num="1,2"
data-matched-content-ui-type="image_stacked"
data-ad-format="autorelaxed"
data-ad-client="ca-pub-mypubid"
data-ad-slot="myadslot#"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


It's not a lack of ad inventory creating the problem. When I only go with one set of numbers for the row/column, I get tons of ads if I say, set the rows to 8. Instead, where the problem happens is if I add that second set of numbers (aka....1,4 or 4,1, etc...).

I've even tested data-matched-content-rows-num="1,1" and data-matched-content-columns-num="1,1" and the result is the same - a blank page.

Since there's plenty of ad inventory, it's obvious I'm doing something wrong. But since I'm using the code Adsense supplies in their help section, I'm at a bit of a loss what I'm doing wrong.

Any ideas?

Thanks

Jim

Edit: I tried this code. I hoped it would give me one column with 4 rows on desktop (aka, a 160x600 banner) and then a one row/four column ad on mobile. But I get nothing again.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-matched-content-rows-num="1,4"
data-matched-content-columns-num="4,1"
data-matched-content-ui-type="image_stacked"
data-ad-format="autorelaxed"
data-ad-client="ca-pub-mypubid"
data-ad-slot="adslot#"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


Another Edit
This code deployed just fine. All the problems seem to come when I apply the comma and second number in the "rows-num" and "columns-num" line. I'm at a loss why this is happening, since this code is ripped right out of Adsense Help.


<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-matched-content-rows-num="2"
data-matched-content-columns-num="2"
data-matched-content-ui-type="image_stacked"
data-ad-format="autorelaxed"
data-ad-client="ca-pub-mypubid"
data-ad-slot="slot#"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
6:31 am on Feb 21, 2018 (gmt 0)

Senior Member from US 

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

joined:Sept 26, 2001
posts:12913
votes: 893


Hello jimh009,

I just use the unedited responsive code with matched content box checked. Columns and rows adjust automatically to the space available.

Unless I am misunderstanding your post.
9:19 am on Feb 22, 2018 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 24, 2002
posts: 512
votes: 5


Hi,

I tried that and it was absolute disaster. I ended up with ads that ended up being one column and having like 10 ads. They stretched all the way down the page. It was happening both for in-content ads (where I was using 300x250 ads) and for sidebar ads (where the ads were 160x600).

Basically, google isn't trying to fix stuff into the space on my site. Hence my attempt to try to set the parameters, which unfortunately haven't worked well either.
9:51 am on Feb 22, 2018 (gmt 0)

Senior Member from US 

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

joined:Sept 26, 2001
posts:12913
votes: 893


I control them with divs. I set the width/height in CSS, then the responsive ads fill what I have allowed.

I basically use 3 div sizes for hundreds of pages so it's simple to manage using server side includes (SSI.) Anyway, it works for me.

Good luck