Unleash the Power of Popups

You'll need to implement the following Javascript to actually bring it all together.

function DisplayInfo() {
	var expdate = new Date();
	var visit;
	expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 
	if(!(visit = GetCookie("visit"))) 
		visit = 0;
	SetCookie("visit", visit, expdate, "/", ".websitepublisher.net", false);
	if(visit == 10) 

function popup(){

The first two lines of the DisplayInfo() function are just variable initializations and you don't need to worry about them. The third line sets the expiration date on the cookie (1000 years) you can edit this as necessary. Expirations work in seconds, so if you want the cookie to expire one day from now you would use expdate.getTime() + (24 * 60 * 60) , which is basically the current time + the number of seconds in a day.

The next three lines load and increment the visits variable from the cookie, or if the variable does not exist it is reset. Then the cookie is rewritten, or written for the first time, with the newly incremented visits variable. You will need to edit this line to use your domain.

The final two lines you need to edit. What they do is actually open the window (or run the function that opens the window) depending on your condition. In this case the condition is when the visits variable equals ten, or on a user's tenth page view.

The popup() function can be edited to open up and position the window to your liking. The left|top screenx|screeny variables actually do the same things, but I include both for browser compatibility issues. For more window formatting features lookup the Javascript window.open() function.

Finally you need to add an event handler to your body tag, depending on your preferences you can use either OnLoad or OnUnload as in the following example.

<body OnUnload = "DisplayInfo1();">

We're Done

There you have it, you should now be able to completely implement this feature on your site. Try it out for a week and see how much it increases your conversion rate.