Compatibility for Google AdSense

Posted in: Newspaper
Post count: 623

Hello team tagDiv,

Google AdSense doing a great job by providing various ad units to boost earning. But unfortunately, Newspaper’s ad panel does not support most of them.

For Google AdSense, theme adds its own conditions to the code like this:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><div class="td-g-rec td-g-rec-id-content_top  ">
<script>
var td_screen_width = window.innerWidth;

                    if ( td_screen_width >= 1140 ) {
                        /* large monitors */
                        document.write('<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-XXXXXXXXXX" data-ad-slot="XXXXXXXXXX"></ins>');
                        (adsbygoogle = window.adsbygoogle || []).push({});
                    }
            
	                    if ( td_screen_width >= 1019  && td_screen_width < 1140 ) {
	                        /* landscape tablets */
                        document.write('<ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px" data-ad-client="ca-pub-XXXXXXXXXX" data-ad-slot="9450419862"></ins>');
	                        (adsbygoogle = window.adsbygoogle || []).push({});
	                    }
	                
                    if ( td_screen_width >= 768  && td_screen_width < 1019 ) {
                        /* portrait tablets */
                        document.write('<ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px" data-ad-client="ca-pub-XXXXXXXXXX" data-ad-slot="9450419862"></ins>');
                        (adsbygoogle = window.adsbygoogle || []).push({});
                    }
                
                    if ( td_screen_width < 768 ) {
                        /* Phones */
                        document.write('<ins class="adsbygoogle" style="display:inline-block;width:320px;height:100px" data-ad-client="ca-pub-XXXXXXXXXX" data-ad-slot="9450419862"></ins>');
                        (adsbygoogle = window.adsbygoogle || []).push({});
                    }
                </script>
				</div>

and that’s the reason, matched contents ad, In-feed ads, in-article ads do not work correctly.
Ad units

Some of them work correctly on a mobile theme (using td-mobile plugin).

This is how ad looks after using theme panel for ads:
ads from theme panel

Ads by adding direct code or using 3rd party plugin, for example, Simplest Adsense Ads Manager – By Crunchify
https://image.prntscr.com/image/Urc4Xz5-REuEeDUaWqk-FA.png

I tried adding matched ads and working fine but activating td-speed-booster plugin breaks the ads.

If possible add condition to disable those conditions. Talking about the responsiveness, almost all the ad units are responsive by default so they will work correctly on the all screen size.

Thank you!

Post count: 20685

Hi,

I will pass these suggestions along to the developer theme. But please take into consideration that the list of suggestions and recommendations is very big, so there cannot be any promises made. Each has to be reviewed and decided as to when it may be viable to implement.

Thank you!

Post count: 9544

We use the AdRotate plugin, then put the shortcode into the templates.

Post count: 623

Hey Chris,

Yea, it’s possible to put ads out of the content area, But how can we add shortcodes in the content?

Post count: 9544

Using the adrotate shortcode in a post or page using shortcode where you want ad to appear. Covered in adrotate docs.

Post count: 1

Can you confirm that matched contents ad, In-feed ads, in-article ads are not supported by the theme?

Post count: 20685

Hi,

At the moment these are the only article ads options available
https://forum.tagdiv.com/article-ads/
For the category pages there are no options to place in feed ads. There are solutions to implement them
https://forum.tagdiv.com/topic/ads-on-category-pages/
Or maybe through a plugin that has options to insert ads. Maybe there will be changes regarding ad type support in a future update and such options will be available by default, but I cannot say for sure.

Thanks

Post count: 45

I’m also after a solution! I hope they bring updates so you can implement these new google ad formats!

Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic.