Displaying Ads in Wordpress

Associate
Joined
31 Jan 2010
Posts
283
Location
UK
Just wondering how people display ads in Wordpress reliably in multiple resolutions and across multiple devices? In particular (but not limited to) Adsense Ads.

I have tried a few plugins but none seem to be reliable enough. Basically I think I need to work with Media Queries? But not totally sure.

What I want is for different size ads to be displayed based on browser window/device resolution. But also if a browser window is resized it auto switches to a smaller ad block rather than running off the screen.

Any advice on this? Anyone have experience with this?

Thanks in advance!
 
Would avoid Adsense until you've got a decent amount of organic traffic. Far too easy to lose those accounts :(.

As for the resize I have used media queries before. Check viewport size and then display the appropriate size ad unit. An If statement would cover it. There's a few example scripts googling might be worth looking at one to see how they did it.

The main issue is automatically resizing, Adsense (others may) when the window resizes doesn't refresh automatically although cases where viewport changes dramatically enough to change ad units is probably rare at best.

Must admit I'm surprised Adsense doesn't have it built in yet.
 
If I recall correctly the site will need to be live for Google to approve your site for Adsense. So I would get it live then look into adverts.
 
Last edited:
You can get Responsive Ad units directly out of the AdSense interface. So, you just need to make sure whatever divs you are putting the ads into are responsive.
 
Back
Top Bottom