Ads Top

How To Make Your Media.net advertisements responsive



Media.net is a wonderful advertising network from the Yahoo Bing alliance it uses contextual advertisements that are text based and soon to be released rich media advertisements. However, there is no luck in sight for responsive advertisements like those of Adsense so what do you do? You shouldn't use, display none as this raises issues against the terms of service much like Adsense, you can't conceal the advertisement so you have to show the advertisement. However, a 300x600 advertisement looks horrible on mobile devices so what is the alternative?

Well, you can't use CSS to show one like Adsense because the script has to be able to recognize them and that is handled on their server so what do you do? This issue can be solved with JavaScript and below is the code.

<script id="mNCC" language="javascript">
if (window.innerWidth >= 960) {
medianet_width='160';
medianet_height= '600';
medianet_crid='INSERT ADVERTISEMENT ID HERE  ';

} else if (window.innerWidth >= 728) {
medianet_width='180';
medianet_height= '150';
medianet_crid='INSERT ADVERTISEMENT ID HERE  ';

} else {
medianet_width='160';
medianet_height= '90';
medianet_crid=' INSERT ADVERTISEMENT ID HERE ';
}
<script><script id="mNSC" language="javascript"src="http://contextual.media.net/nmedianet.js?cid= INSET PUBLISHER ID HERE"></script>

The above script basically says that if the screen size is this large then load the advertisement fitting those parameters. You need to fill in the crid which is your advertisement ID and the cid on the final line with your publisher ID.This code is not responsive if the screen size changes meaning if you switch the layout of your tablet to portrait  from landscape the smaller advertisements will continue to show until the website is reloaded.

4 comments:

  1. If you are looking for a solid contextual advertising network, I suggest that you try Clicksor.

    ReplyDelete
  2. Great Article. This little snippet really works.

    ReplyDelete
  3. where did you find that publisher id and advertisment id?

    ReplyDelete

Powered by Blogger.