Ad units vs. Responsive grid

CLKeenan

Banned
Jun 24, 2006
2,506
14
0
Boston, MA
So I'm faced with a problem on my responsive grid site. Our ad network has two leaderboard sizes, 970x66 pushdown and standard 728x90. The 970 fits on the wide resolution breakpoints, while the 728px fits on the normal resolution. We were just simply using display:none css for when the 970px wouldn't fit properly on the resolution, but that doesn't stop the ad impression from being called. This creates a problem with ad server impression reporting.

Any suggestions for how we can go about turning on and off ad units so that if they don't fit on the page, the impression doesn't get called?

Thanks
-Chris
 


Detect the screen resolution with javascript and if the resolution is bigger, write the ad code from server for 970x66 banner. If it is smaller, you should write code to display the 768x90 banner.

The javascript code to write to document is document.write("");

The technique I describe is used by many ad networks, even google itself.
 
I've used JS to check the screensize, and then load ads based on that.

Code:
viewWidth = $(window).width();

	if(viewWidth < 970){
		// do something
	} else if(viewWidth > 970 ){
		// do something else
	}

With jQuery