How to conditionally display ads (via an ad server) to different screen size for mobile devices?
I don't want to set the display to none for hiding content, as this will skew the ad impression count.
I want to inject the ad code (eg. ) into div using client-side javascript without jQuery.
For example,
<div id="adzone"></div>
If width < 768px
inject ad code for mobile
else
inject ad code for tablet
How do I implement this idea?
And how will situation be handled when device rotation taking place when device width changes from less than 768px to grater then 768px?