July 4, 2010

Widgets

Random Ad Banners Widget For Blogger


Random-Ad-Banner-Widget In most blogs which are selling ad spots you often have seen random Ad banners appearing when the page is refreshed. Ever wondered how to show random Ad Banners in Blogger? In today's tutorial we will learn how to create a Random Banner Widget for blogger which will show random Ad banners when a visitor visits a new page on your blog. Using this widget you can display as many Ad banners on a Sponsor Area as you want!
This widget is exactly similar to our previous 125 by 125 AD Banner Widget and in fact it is the most awaited one and have been requested several times by our readers. Just last night I succeeded in creating a simple Java script that uses Array of images and thus displays random images on Page refresh. 

Lets have a demo of the widget before jumping to the tutorial. Note:- Refresh the page to see new Ad banners.


Live Demo


How To Add Random Ad Banner Widget To Your Blogs?

Simply follow these steps,
  1. Go To Blogger > Design > Page Elements
  2. Choose HTML/JavaScript Widget
  3. And Paste the following code inside it,
<div align="center">
<table border="0"  cellpadding="2" cellspacing="6" width="265" bgcolor="#ffffff">
<tbody><tr>
<td><center>
<!--  BANNER#1  -->
<script language="JavaScript">
images = new Array(2);
images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-1' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-2' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>
</center></td>
<td><center>
<!--  BANNER#2  -->
<script language="JavaScript">
images = new Array(2);
images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-1' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-2' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>
</center></td>
</tr>
<tr>
<td><center>
<!--  BANNER#3  -->
<script language="JavaScript">
images = new Array(2);
images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-1' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-2' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>
</center></td>
<td><center>
<!--  BANNER#4  -->
<script language="JavaScript">
images = new Array(2);
images[0] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-1' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
images[1] = "<a href = 'URL OF ADVERTISER' rel='nofollow' ><img src='URL OF BANNER’S IMAGE-2' border='0' height='125' width='125' alt='AD DESCRIPTION'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
</script>
</td></center>
</tr>
</tbody></table>
<table border="0" bordercolor="#0084ce" cellpadding="2" cellspacing="6" width="265" bgcolor="#ffffff">
<tbody>
      <tr>
       <td><center><a href="URL OF ADVERTISER" rel="nofollow"><img width="265" height="37" border="0" alt="Advertise Now!" src="file:///C:/Documents%20and%20Settings/Mohammad/Desktop/ADVERTISE-HERE.gif" /></a></center></td>
      </tr>
    </tbody></table>
</div>

MAKE THE FOLLOWING CHANGES:-
1.  Replace URL OF ADVERTISER with the website link of the advertiser
2.  Replace URL OF BANNER’S IMAGE-1  and URL OF BANNER’S IMAGE-2 with the Image links of the Advertiser’s banners
3.  Replace AD DESCRIPTION with some information related to the Ad. The description appears on mouse hover.
4.  If you want to increase the distance between the ad blocks then edit width="265"
Now after making the necessary customization view your blog to see a beautiful 125 by 125 Banner widget that will change Banners on every different page.

Download Animated AD Banners

To ad spice to the widget may be you will prefer some of our previously designed animated banners -> Animated 125 by 125 AD Banners
Do let me know how did you find this new and useful widget. Take care! :D



If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you Subscribe to our regular Email Updates!

If you don't want to get yourself into Serious Technical Trouble while editing your Blog Template then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your order details by Clicking Here »

74 comments:

Rafay Baloch on Jul 4, 2010, 1:32:00 PM said... #
This comment has been removed by the author.
Rafay Baloch on Jul 4, 2010, 1:35:00 PM said... #

Great work but I have one doubt that wont it slow the load time of website.Load time is a crucial factor in SEO.what do you think?


Microsoft 2010 Product key

Khalid on Jul 4, 2010, 8:20:00 PM said... #

Nice Post Mustafa, I will try to use it in my blog, thanks.

simplycodes.com on Jul 6, 2010, 6:10:00 AM said... #

Thanx mustafa...very nice post. Im thinking to use it in my website

pc games and movies on Jul 6, 2010, 12:00:00 PM said... #

thanks bro,

I will try on my blog

Zeegi on Jul 7, 2010, 11:22:00 AM said... #

I'm one of those in your post here http://www.mybloggertricks.com/2009/09/125-by-125-ad-banner-widget-for.html who requested about random image show ads.

this is good.. I hate messing the "Edit html"
I will try this later in my blog http://zeegi-comix.blogspot.com/
I will try experimenting it if I can change the width and height or maybe make it a marquee style

Mohammad Mustafa Ahmedzai on Jul 7, 2010, 2:42:00 PM said... #

@Rafay

Dear the images indeed are 8 in numbers but if you upload them all at blogger then it will not effect the loading that badly.

@khalid @simplycodes @pc games

Thank you all for liking it! :>

@Zeegi

Yes dear I hope I fulfilled my promise :p

Beben on Jul 8, 2010, 4:08:00 PM said... #

wow...its cool
why you aren't make like meta tag generator my friend...;))
nice nice...

Zeegi on Jul 9, 2010, 6:53:00 PM said... #

I have a problem with this trick.. sometime when i refresh the pages the img dont show and it says undefined.. did you encounter that problem

Bharath on Jul 15, 2010, 4:55:00 PM said... #

Great......this is the one i m looking for.....its look great on my blog..........
http://topblogger1.blogspot.com/

Mohammad Mustafa Ahmedzai on Jul 17, 2010, 1:36:00 AM said... #

@zeegi

Which host are you using to store your images. Make sure you use blogger only. To know how to save images in blogger and get Direct Image Links read this post

@bharath
Congrats! :D

Saadhu Agashe said... #

bro dun laugh at ma quest... m actually new in business... so plz assist me...
How can I post to my blog?

MIDO on Jul 19, 2010, 5:35:00 AM said... #

thanks mohammed nice topic

Raja on Aug 6, 2010, 7:08:00 PM said... #

hi,
I am looking for this kind of post in the web,finally find that..I will try this..

şarkı dinle on Aug 7, 2010, 4:42:00 AM said... #

thank you

samsexy98 on Aug 10, 2010, 7:27:00 PM said... #

hi all....
i m the 200th follower to follow this blog... :)
hurraayyyy...

Three cheers for this blog...
Hip Hip Hurray
Hip Hip Hurray
Hip Hip Hurrayyyyyy

mary on Aug 10, 2010, 10:31:00 PM said... #

hey Mohammad ^^ i realy need your help...idk what did i do some mounths ago with my background. I entered on a site and i think i copied a url code of a pic and i put it (i guess) in a Html Widget on my blog. That was ok and beauty.But now,the image has expired from PhotoBucket.

Im trying to use the other metod with Url in "Edit Html" like:



background-image: url(enter your url here);


but doesnt work! :( i need to delete that widget but i have no idea where it is !

Can u help me? i can share u my blog's platform html...

P.S. my blog is: www.lucruri-spontane.blogspot.com


Your still number 1# fan,Mary :-)

mary on Aug 13, 2010, 3:41:00 PM said... #

nevermind Moh! i did it myself :D!!! Ty for read anyway :D !

yyaabadabaduuu xD


xoxo,mary (•ิ_•ิ/)

Ibrahim Kamrul Shafin on Aug 25, 2010, 1:21:00 PM said... #

Assalamu Alaikum,

Thank you very much Mustapha Brother. I'm going to use this code to my blog www.productivehobbies.blogspot.com ; but yet I do not know how to find the advertisers who will pay me $10 for placing their ads in my sidebar widget!

Thanks.
Hope you reply.
Allah Hafez.

Anonymous said... #

before clicking on these adds i want all people to rea the link below

http://www.buildfreedom.com/tl/tl12.shtml


the link is about how to achieve emotional control

some people use emotional out bursts in order to gain maxinmum advantage.

why our respected blogger said it is the only income he rely on his my pocket money??


be profesional mustafa if visiters are using ur blog it is ur right to request them, why using emotional words????


anyway best of best


regards fahad sarwar :D

Anonymous said... #

sorry i mean best of luck :D

Anonymous said... #

sorry mustafa

fahad sarwar

zulkbo on Sep 5, 2010, 8:51:00 PM said... #

salam..
menarik ni
bolehlah mulakan
meniaga iklan sendiri
di blog erk?TQVM

Beben on Sep 11, 2010, 2:36:00 PM said... #

happy idul fitri
taqobalallahu mina wa minkum

swagger on Oct 7, 2010, 8:07:00 AM said... #

beautiful..

Richard Carter on Oct 16, 2010, 11:54:00 AM said... #

Well, a very nice tutorial.

But can we implement the same if we want to show just one banner.

Layla White in Canada on Oct 19, 2010, 6:17:00 AM said... #

Where do I exactly copy and paste the code? I tried it on my blog and it messed up the template. :(

Mariel on Oct 24, 2010, 1:41:00 PM said... #

Love your templates. I hope to be able to make my own one day.

flash website templates

Review Monsters on Oct 26, 2010, 3:48:00 AM said... #

Good post, thank you! Going to add this to our blog!

Essay Writing Help on Nov 11, 2010, 5:14:00 PM said... #

After read blog topic's related post now I feel my research is almost completed. happy to see that.Thanks to share this brilliant matter.
Essay Writing Help

Bloggertricksandtoolz on Nov 12, 2010, 5:06:00 PM said... #

Gread Post

Bhathiya on Dec 1, 2010, 11:48:00 PM said... #

Great article helped me a lot

Anonymous said... #

Nice one.

Mesothelioma on Dec 15, 2010, 10:53:00 AM said... #

I love this article and it is so fabulous and I am gonna save it. how can i get a copy of this theme? – Thanks for sharing article.

seo melbourne on Dec 20, 2010, 11:49:00 AM said... #

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

Hacking Tutorial and Network Security on Dec 21, 2010, 10:07:00 AM said... #

for long time i searched for this advertisement widget. Finally came to this place.

Mohammad Mustafa Ahmedzai on Dec 21, 2010, 8:55:00 PM said... #

I am happy you people find it useful and yeh sorry for the late reply I just got a chance to pay a visit to my blog after a long break! :P Thank you all for your love.

Jitendra Rawal on Jan 3, 2011, 8:12:00 PM said... #

i want to make a random header banner 468x60. how to do that

samsexy98 on Mar 9, 2011, 5:32:00 PM said... #

@KVM Switches
Where it is written that this is a trick?

Stuart Clayton on Mar 20, 2011, 4:26:00 AM said... #

Could I make this work with 468x60 banners on the header? If so, how? Just change width and height maybe?

Mohammad Mustafa Ahmedzai on Mar 20, 2011, 10:04:00 PM said... #

@Samsexy

Thanks for spotting the spammer! This is a new spamming technique that is being utilized these days. The text is written in a complex style that you cant even understand what it says.

@Jitendra @ Stuart

Of course you can and thanks for the new idea. I will write a detailed post on it. Please be patient. The codings will be different.

Stuart Clayton on Mar 20, 2011, 10:16:00 PM said... #

No problem! And thank you a million, I've been looking everywhere for one that works but can't find one. Eagerly awaiting! Thanks!

samsexy98 on Mar 20, 2011, 11:08:00 PM said... #

@Mohammad
I used to kick out spammers on Linkbucks forums by helping the Moderators, so I can understand a bit easily who is a spammer. :)

Xion on Apr 8, 2011, 2:07:00 AM said... #

nice post.

http://www.xionsms.com

Yuriy said... #

Thanks for post. I wanted to ask whether there is a flexible script that you can adjust the length and width
http://compteh.10xl.net

Mohammad Mustafa Ahmedzai on Apr 22, 2011, 1:00:00 AM said... #

@Yuriya

you will have to do that manually by adjusting width="". Let me know if you needed more help. :>

Mary on Apr 26, 2011, 8:47:00 PM said... #

@Mohammad, might this is NOT included on the topic but I would like to know how can we get Advertisers as you do. I mean it shall be a website or smth :-?
For exemple, you got those banners in the right top corner on your blog. Did those advertisers pay you?

I look forward to hearing an answer.

xoxo, Mary

Mohammad Mustafa Ahmedzai on May 20, 2011, 5:10:00 PM said... #

@Mary

Mary I apologies for the late reply and now to compensate your query I must write a post on it. Give me just two days and you will have a detailed answer in front of you. :D

thesis papers on Jun 14, 2011, 8:07:00 PM said... #

nice buddy

Lera Keng on Jul 25, 2011, 11:52:00 PM said... #

This is the best post I have found for this subject in regards to what I am trying to do and I have got it working for my blog! Yay!
BUT I have a question/request - as far as I can tell from the code and watching my site, this only changes from 2 images in each block, is there a way I can make this function for 6 (or more) blocks with the randomization of 6 (or more) different pictures so that no picture is duplicated in the display when it is viewed? Basically, I need to show 6 image blocks (with the possibility of it growing) but I want the randomization to occur from top to bottom with each picture rotating so that no image is always at the top-most or bottom-most position and there are no duplications in the images when it is being displayed. I hope that is understandable!

$hubham on Aug 1, 2011, 9:19:00 PM said... #

@Mohammad
I love this article and it is so fabulous and I am gonna save it...

SHUBHAM MEHTA
http://www.smashingGadget.blogspot.com

displaybanner on Sep 18, 2011, 6:41:00 PM said... #

thanks for the code it is quite useful
display banner

pullupbanner on Sep 18, 2011, 6:51:00 PM said... #

this code might help alot thanks for shairng
pull up banner

PRODIP on Sep 21, 2011, 1:51:00 AM said... #

I am facing problem with my template. I want to make my sidebar wider (About 260px) but I could not do this. I need ur help.
http://fishclickbd.blogspot.com

ashvin art on Sep 23, 2011, 1:07:00 PM said... #

please tell me this trick working on ads for indians........

pullupbanner on Sep 25, 2011, 6:50:00 PM said... #

nice informative post,it is working properly
pull up banner

Rout on Oct 12, 2011, 7:19:00 PM said... #

nice post mohammad
http://latestjobsinorissa.blogspot.com/

emily parrr on Nov 22, 2011, 5:11:00 PM said... #

I entered on a site and i think i copied a url code of a pic and i put it (i guess) in a Html Widget on my blog. That was ok and beauty.argumentative essay format

Bruce Willis on Dec 18, 2011, 4:09:00 PM said... #

Your depiction is attention-grabbing. Thanks for the widget.
Phone sex uk

Edel |Moon Walkerz on Dec 21, 2011, 11:08:00 AM said... #

Thanks man I've been looking all day for somenthing like this all day, and finally I found it, your website has helped me alot!

Oguntayo Mathew AdeKunle on Dec 27, 2011, 6:11:00 PM said... #

this is a very nice one bro, thanks very much.

Epic-Fun on Jan 19, 2012, 5:16:00 PM said... #

Hi, how do i make that when someone click on banner it opens in another page, so i won't lose visitors..?

DJ Ferr on Jan 21, 2012, 1:42:00 PM said... #

Hi...

I would like to ask.
How to reload the ads without refreshing the website or the page of the website. I mean just the ads itself changing. You can see Sharebeast.com for example. Each 30 seconds the ads will change to another ads without the page being refresh.

Thanks in advance. visit my blog www.previewmusik.com

DJ Ferr on Jan 21, 2012, 1:44:00 PM said... #

@Epic-Fun

just edit the < a > tag with target='_blank'

is this what you means?

Jobsin East Africa on Feb 10, 2012, 6:37:00 PM said... #

Dear Moha,

Thanks for the informative articles

I have several questions and I will ask them under this article,

1. Is ti possible that I create my own banners such that advertisers would automatically upload their adverts on my blog and pay without leaving the site?

2. My blog description does not show when I use Meta Tag Analyzer

3. The search results of my blog on google.com and google.co.ke is different. How do I get my blog crawled by google.co.ke

http://jobsandcareersinkenya.blogspot.com/

trickslove on Mar 3, 2012, 11:59:00 AM said... #

good post Ahmedzai... i will try this.... thanks

MyWebsite on Apr 23, 2012, 5:43:00 PM said... #

I must say that overall I am really impressed with this blog. It is easy to see that you are impassioned about your writing. I wish I had got your ability to write. I look forward to more updates and will be returning.
how to increase website traffic

noveltechnic.com on May 22, 2012, 8:07:00 AM said... #

My lot of thanks for you..
good post..good way..

Blogging on Dec 2, 2012, 6:33:00 PM said... #

Nice coding.

am used in my site > www.padugai.com

but, don't know. How to set keyphrase in bottom of the image?

Can Demir on Dec 30, 2012, 4:54:00 AM said... #

Good Post (y)
efecanfan

Leonardo Augusto on Jan 28, 2013, 3:11:00 AM said... #

yeah so good!!!

Contributor Tt on Feb 20, 2013, 7:06:00 PM said... #

Great idea! How can we implement it for 300x250 banner so to display the ad in random?

Nakul Modak on Mar 22, 2013, 2:22:00 PM said... #

Banner design widgets, very useful and so much essential in today's world.

peter jacson on May 8, 2013, 5:04:00 PM said... #

Good stuff. It is interesting to read comments.Coach Training

Click Here To add Comment

Confused? Feel free to ask

Your feedback is always appreciated. We will try to reply to your queries as soon as time allows.

Note:
1. To add HTML CODE in comments then please use our HTML Encoder
2. You can always Test the tutorial on our HTML Editor
3. No cheesy/spam Comments tolerated Spam comments will be deleted immediately upon our review.

Regards,
Mohammad

Support Us

If our Tutorials have helped you a little, then kindly spread our voice using the badge below:-

or try a Beautiful Banner


Widgets

 
  • MBT Icons and buttons

    Icons and Buttons

    Our resources have been successfully downloaded over 10K times and found almost every where. Get yours!

  • choosing webhost for a blog

    Why HostGator?

    Learn Why we chose HostGator as our Web Host and find discount coupons to kick start your blog today!

  • SEO Settings for blogger

    ALL IN ONE SEO PACK 2012

    Learn every single SEO tip that will boost your blog's ranking and organic traffic. We got them all!

  • Blogger widgets and plugins

    Visit MBT's Blogger LAB

    Why not take a tour of all great Blogger widgets published so far? You Name it we have it!

  • become a six figure blogger!

    Become a SIX FIGURE BLOGGER

    Learn what it takes to become a successful entrepreneur and build a living online!

About The Author

Hi! I am Mohammad, a certified SEO Consultant, Pro Blogger, Computer Engineer and an addicted Web Developer. Read More..

Recipes

SEO Affiliate Marketing Social Media

Make Money Online Web hosting

Blogging Tips Web Designing

Plugins and Widgets Blogging Ethics

Recent Comments

Popular Series

Powered by:

My Blogger Tricks © 2013. All Rights Reserved | Contact |