Block Ads in Wordpress, while mobile view

Hi there,
Quite recently I’ve created a native app (webview app)of my wordpress website and this wordpress site is using responsive theme as well. Now I want to publish this app at play store. The problem is that Adsense are not allowed to be shown in a native android app. So I want to know how I can block adsense in this native android app? as I will place admob in this android app. I searched a lot but could not find that how I can do this? Adsense are showing in mobile view of my website but I want that these adsense would not show in mobile view, specially in android web view.

thanks in advance

Use a different set of templates that don’t have any ad code in them?

1 Like

how its possible to use a different theme for mobile view ??

Perhaps use some browser/device sniffing them load up template or partials to match. I’m sure there’s a WP plugin somewhere that lets you detect what device someone is using…

Incidently Craft CMS has a useful template tag which can output or omit content based on whether the visitor is using a mobile browser or not, something like this would prevent content being shown to a mobile device so it is possible:

{% if not craft.request.isMobileBrowser %}
    {your_ad_code}
{% endif %}

I would use DFP, and then depending on what device they are on serve the appropriate DFP tag, either for google adsense or for admob … basically you are using CSS and jQuery/Javascript to choose different DFP Ad Units

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.