Reputation: 316
So, we run ads on our WP site, Mostly from direct clients.
However, I'm wanting to do two things: transition one position over to AdSense to see what it gives us in terms of revenue.
Second, as direct clients never want mobile ads, I'm planning on adding an adsense responsive/mobile ad unit for small screens.
I am planning to have a 300ish wide ad stuck to the bottom of the screen that stays in position during scrolling.
The question is: I'd like the responsive ad unit to only display for smaller screens, i.e. those that match the mobile media query. However, I'm wondering if the best way is to only show the unit using the media query, or whether I should only inject the adsense code for when we detect a small screen size or a mobile user-agent through PHP.
As well as a decent technical solution, I'd like to make sure I don't upset Google by contravening their T&C's.
Upvotes: 1
Views: 209
Reputation: 428
Media query is the only option to have it responsive.
If you use PHP to inject the ad, you should not be targeting the screen size, but rather the browser/platform, because it would create inconsistencies, as in if you open the page on a browser and make the window smaller, it won't show the ad; however if you open the site on a small window and make it bigger then the ad will show even with a bigger screen.
I'm not sure about Google's policy regarding this, my biggest concern is that you might be still be pulling an ad but not showing it, which can be problematic.
Upvotes: 1