![]() |
Webmaster Forum Rules | Posting Guide | Contact Us | Testimonials | Contributing Geek Program | Advertise on Geek/Talk |
|
|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 |
Registered User
Join Date: May 2001
Location: UK
Posts: 822
|
![]()
Hi all,
I use Bulletmedia as my ad network, and theys erve ads through DoudleClick DART. So that is my code. I need to add a random number generator to the add code so it writes a 5 digit number different for ever page view. I need it to write the same number 4 times in the code. I think you can do this with javascript. I would appreciate any help with it, as I'm a complete newbie to JavaScript. Cheers Tim Become a musician - Musicware http://www.musicware.dial.pipex.com/ |
![]() |
![]() |
![]() |
#2 |
Registered User
Join Date: Apr 2001
Location: Mountain View, CA US
Posts: 68
|
![]()
Hi, I think the following code should generate a random 5 digit number. Just add your adnetwork code in the "document.write" part of the code inserting '+RN+' wherever you want the random number inserted. If you code is more than just a image and click URL you can add more document.write lines. HTH
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin RN = Math.floor(Math.random() * (1 + 99999 - 10000) + 10000); document.write('<a href="INSERT YOUR CLICK URL HERE?'+RN+'">'); document.write('<img src="INSERT YOUR IMAGE URL HERE?'+RN+'"></a>'); // End --> </SCRIPT> |
![]() |
![]() |
![]() |
#3 |
Registered User
Join Date: May 2001
Location: UK
Posts: 822
|
![]()
Thanks a lot for your help John!
But I'm still stuck on how to implement that random number generator. Here's the code I have to add to my pages: <IFRAME SRC="http://ad.doubleclick.net/adi/musicware.bulletmedia/;sz=468x60;ord=19761534551833420?" name="frame1" width="468" height="60" frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"> <SCRIPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=19761534551833420?"> </SCRIPT> <NOSCRIPT> <A HREF="http://ad.doubleclick.net/jump/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=19761534551833420?"><IMG SRC="http://ad.doubleclick.net/ad/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=19761534551833420?" border=0 height="60" width="468"></A> </NOSCRIPT> </IFRAME> I have to replace every time the number 19761534551833420 with the random generated number that is 5 digits or more. Thanks in advance Tim Make yourself a better musician - Musicware http://www.musicware.dial.pipex.com/ |
![]() |
![]() |
![]() |
#4 |
Registered User
Join Date: Apr 2001
Location: Mountain View, CA US
Posts: 68
|
![]()
Ok, you could try the following ...
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin RN = Math.floor(Math.random() * (1 + 99999 - 10000) + 10000); document.write('<IFRAME SRC="http://ad.doubleclick.net/adi/musicware.bulletmedia/;sz=468x60;ord='+RN+'?" name=\"frame1\" width=\"468\" height=\"60\" frameborder=\"no\" border=\"0\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" SCROLLING=\"no\">'); document.write('<SCRIPT language=\"JavaScript1.1\" SRC="http://ad.doubleclick.net/adj/musicware.bulletmedia/;abr=!ie;sz=468x60;ord='+RN+'?"></SCRIPT></IFRAME>'); // End --> </SCRIPT> <NOSCRIPT> <A HREF="http://ad.doubleclick.net/jump/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=12345?"><IMG SRC="http://ad.doubleclick.net/ad/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=12545?" border=0 height="60" width="468"></A> </NOSCRIPT> For rich media code including Javascript you may want to consider generating the random number on the server side instead of with Javascript. In other words using something like ASP, PHP or SSI. For example, if your server supports PHP, you could add something like the following before the code ... Code:
<?php srand((double)microtime()*1000000); $random = rand(10000,99999); ?> Code:
<IFRAME SRC="http://ad.doubleclick.net/adi/musicware.bulletmedia/;sz=468x60;ord=<?php echo $random; ?>?" name="frame1" width="468" height="60" frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"> <SCRIPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=<?php echo $random; ?>"></SCRIPT> <NOSCRIPT> <A HREF="http://ad.doubleclick.net/jump/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=<?php echo $random; ?>?"><IMG SRC="http://ad.doubleclick.net/ad/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=<?php echo $random; ?>?" border=0 height="60" width="468"></A> </NOSCRIPT> </IFRAME> Code:
<!--#include virtual="/cgi-bin/cacheburst.cgi"--> Code:
#!/usr/bin/perl srand(time ^ ($$+($$<<15))); my $random = int(rand(100000)); print "Content-type: text/html\n\n"; print <<BANNERCODE; <IFRAME SRC="http://ad.doubleclick.net/adi/musicware.bulletmedia/;sz=468x60;ord=$random?" name="frame1" width="468" height="60" frameborder="no" border="0" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"> <SCRIPT language="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=$random?"></SCRIPT> <NOSCRIPT> <A HREF="http://ad.doubleclick.net/jump/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=$random?"><IMG SRC="http://ad.doubleclick.net/ad/musicware.bulletmedia/;abr=!ie;sz=468x60;ord=$random?" border=0 height="60" width="468"></A> </NOSCRIPT> </IFRAME> BANNERCODE |
![]() |
![]() |
![]() |
#5 |
Registered User
Join Date: May 2001
Location: UK
Posts: 822
|
![]()
You've been a lot of help,
THANKS! Cheers Tim |
![]() |
![]() |
![]() |
#6 |
Registered User
Join Date: Jun 2001
Location: New Delhi, India
Posts: 615
|
![]()
A small question. Why is a random number required with doubleclick code? Do they ask you to do so? Why?
|
![]() |
![]() |
![]() |
#7 |
Registered User
Join Date: May 2001
Location: UK
Posts: 822
|
![]()
LastActionHero,
Yes, they asked me to put this random number generator in my code. They said it is to stop caching. That's all I know I'm afraid, Cheers Tim Improve your music skills - Musicware http://www.musicware.dial.pipex.com/ |
![]() |
![]() |
![]() |
#8 |
Registered User
Join Date: Apr 2001
Posts: 4
|
![]()
You can also right click-view source on this page, I think these ads on the forum use a jscript random thing.
|
![]() |
![]() |
![]() |
#9 | |
![]() Join Date: Aug 1999
Location: Gold Coast, Queensland, Australia
Posts: 9,507
|
![]() Quote:
Still, at least you have connections in all the right places who are ready and willing to offer their assistance. Thanks John! ![]()
__________________
Czar Follow Geek/Talk's Twitter Feed and Facebook Page to stay up to date with new discussion threads and online ad industry highlights. Important GeekVillage Links: Home | Rules | Posting Guide | Report Trouble | Feedback | Advertise on GV |
|
![]() |
![]() |
![]() |
Bookmarks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
random number insertion and phpadsnew | masm50 | Making Money with CPC and/or CPM Programs | 1 | 08-30-2004 02:22 PM |
Random info Javascript generator | pointsi | Web Design and Webmaster Issues | 2 | 03-04-2004 11:05 AM |
DoubleClick to shed 10% of workforce | Czar | Making Money with CPC and/or CPM Programs | 1 | 03-21-2001 10:19 AM |
Random Keywords Generator | diederik | Web Design and Webmaster Issues | 0 | 06-26-2000 12:18 PM |
doubleclick bottom banner??? | notibrian | Making Money with CPC and/or CPM Programs | 4 | 02-07-2000 12:49 AM |