...

View Full Version : Show javascript ad only once per day



newbmonkey
08-21-2011, 01:02 AM
Hey guys, I already saw this post but I wasn't sure if it took care of the question I'm asking.

I have the following javascript ad code right before the </body> tag:


<script type="text/javascript" src="http://ads.affbuzzads.com/smart_ad/display?ad_unit=18&ref=xxxxx"></script>

This is a slider ad that shows every time the person comes to the page I have it on.

I'd like to show this ad only once per 24 hours per visitor.

Can someone please help me out with code to do this? I'm kinda newbish at this.

Thanks so much!

Old Pedant
08-21-2011, 03:42 AM
(1) Look to see if a cookie you previously set is there.
(2) If it is, look to see if it contains today's date.
(3) If *NOT*, then:
-- (3.a) write out the JS script code you showed so the ad appears.
-- (3.b) Set the cookie in place, giving it a value of today's date

I won't bother showing you the setCookie and getCookie code, as you can find them all over the place. (Try "w3c javascript cookies" in google, for example.)

And, yes, you can use JavaScript to document.write other JS code. Or you can use a script object, if you want to be more modern.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum