I’m having trouble with using Responsive Adsense Link Units. I have the correct code provided by Google Adsense but when the code is implemented or applied on the Newsmag Theme Panel, they’re not showing as expected. I even set the sizes to 728×15, 468×15, and 200×90 for desktop, tablet portrait, and mobile, respectively.
My question is, does Newsmag theme have the ability to show Link Ads or only Text and Display ads from Google Adsense? Is it coded differently for Link Ads?
For your reference:
https://support.google.com/adsense/answer/15817?hl=en
https://support.google.com/adsense/answer/3543893?hl=en
Thank you in advance.
Hi
The theme’s ads system is tested and works fine. I am not sure why the ads are not displayed fine on your site but you can try to deactivate all plugins except Visual Composer, clear all caches and test again.
If you still can’t manage to solve this issue please provide your site url so I can inspect it closer.
Thanks!
Hi Andrei,
Thanks for your reply. I did all that and it’s not a caching or plugin problem.
I’m guessing the theme’s way of handling Link Units is different for Text/Display Ads.
I found out that the code is slightly different for link units, whereas text/display ads would show:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1111111111111"
data-ad-slot="1111111111"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
And responsive link units are:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-11111111111111"
data-ad-slot="1111111111"
data-ad-format="link"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
The slight difference is in the “data-ad-format” it’s
data-ad-format="auto"></ins> for Text-Display and
data-ad-format="link"></ins> for Responsive Link Units.
Could you please check if Newsmag theme really recognizes the slight difference in code for responsive link units?
Thank you!
Also, does this make sense to you? Does it apply for the newsmag theme?
“The cause is that it wraps each div after loading. So that adsense refuse to load request.”
The error I was getting at dev tools was: Failed to load resource: the server responded with a status of 400 (Bad Request)
Hi
The theme render the google link ads the same way as the usual google ads. A solution for this would be to avoid google link ads being passed trough theme’s render. This can be done by aiding a condition in td_panel_data_source.php file like here: http://screencast.com/t/xTNCNS5cdpvP After adding this condition the theme will render google link ads as other ads and theirs code won’t be affected.
I’ve added this on our list and theme’s developers will investigate it.
Thanks!
Andrei,
I applied the changes you’ve suggested and I’m not sure if I did it right because the link ads were not showing.
I also get this error from the console: pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:6 Uncaught TagError: adsbygoogle.push() error: No link unit size for width=0px
Please advise.
Hi
That error appear because ad-sense javscript can’t read the width for the container where the ad must be displayed. We will investigate this issue when will be possible, meanwhile you can check this tutorial and implement the solution provided there: http://webgilde.com/en/adsense-auto-resizing-error/
Hope this help.
Thanks!
Hi
A basic css would be this one:
.td-a-rec{
display: block;
width: 100%;
height: 100px;
}
However you will need other customizations in order to make it responsive. For every device you will need different values for the width and height, also for all type of layouts where you will want to use the ad, one, two or three rows. The js error from browser console still appears and I couldn’t figured out why so far. This is a task which require deeper investigations and unfortunately I cannot provide a complete solution now.
When the time will allow us we will take a closer look at this issue but I can’t say now when we will have a fix for it.
Thanks!
