It's Sean!

UK freelance journalist, author
and copywriter Sean McManus

Printed from © Sean McManus.
Home > Articles > Webmaster resources > Javascript Toolkit > Javascript examples > Cookies

The Javascript smart marketing toolkit

Javascript cookies tools

The cookies functions will enable you to store data in a cookie and recall it later.

As well as providing routines to enter data in a cookie against a keyword you specify and recall it later using the same keyword, the toolkit provides for several interest counters to be maintained. By default there are seven, but you can add more by editing the toolkit's code.

These interest counters can be used to keep a track of what your visitor is most interested in on your site - which links they follow and which areas of the screen they mouseover. You can use this information to tell them about what's new in the areas they frequent or to try to entice them to sections they rarely visit.

Interactive demonstration

Please enter your name:

What is your best friend's name?

When is their birthday?
(tip: if it's tomorrow, you'll get a special message)

What is your friend most interested in? Music Books Videos

Now click here to see a demonstration of recovering that information.

Overview of Javascript cookie routines

Table explaining cookie management functions of the toolkit
function what it does
set_up() The set_up() routine must be run when the page loads.
poke_cookie(name,value) This routine is used to store any value you like in the cookie, together with a name you can use to recall it again. The demonstration files show how this can be used to ask someone's name and store it in the cookie.
peek_cookie(name) This routine is used to recover the information you've stored in the cookie, using the same name as used with poke_cookie().
delete_banner_cookie() This will clear the cookie.


These routines will increase and decrese the counter number given in brackets. The counters must be configured by editing the code in the set_up() routine.
interest_enquire(interestnumber) Returns the current total for the interest number requested in brackets.
most_interested() Reveals the interest with the highest counter level.
least_interested() Reveals the interest with the lowest counter level.

Cycling banner advert

See the page on banner cycling features of the toolkit for more information on what this is doing and how it works.

Navigating the toolkit: