Simple Exit Console – An attempt to maximize your traffic

An exit console is supposed to make a last attempt to convert your traffic, just before the visitors is leaving your website. Most of the times it turns out to improve your conversion rates, some other times you won’t see much of an effect. So if you wanna get yours, here is a customizable code you can blend into your adult website.
Unlike a common popup window, an exit console is less aggressive
- It pops when the user is trying to navigate away from your website. That is when the user clicks an outbound link, or the user attempts to close the window.
- If it occurs on windows closing, you end up with still a single open window, unlike the common popup hell, where you end up with a couple of open windows, and who knows how many more generate when trying to close those.
Hence, an exit console is a slightly more white-ish approach if you wanna go the popup way.
The code
<?php$exitpages = Array(
'http://google.com',
'http://microsoft.com',
);?>
<script>var TimeLimit = 0;
var Page_ShowPopOnExit = true;
var Page_ShowPopOnClicks = true;
var MySiteDomain = '<?php echo $_SERVER['SERVER_NAME']; ?>';
var Page_Enter;function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}if (readCookie("NoPopup") == '1') {
Page_ShowPopOnExit = false;
}function display(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=650,height=420');");
}function XBrowserAddHandlerPops(target,eventName,handlerName) {
if ( target.addEventListener ) {
target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
}
else if ( target.attachEvent ) {
target.attachEvent("on" + eventName, function(e){target[handlerName](e);});
}
else {
var originalHandler = target["on" + eventName];
if ( originalHandler ) {
target["on" + eventName] = function(e){originalHandler(e);target[handlerName](e);};
}
else {
target["on" + eventName] = target[handlerName];
}
}
}function InternalLink() {
Page_ShowPopOnExit = false;
}function PageEnter() {
Page_Enter = new Date();
}function SiteExit() {
var time_dif;
var Page_Exit = new Date();
time_dif = (Page_Exit.getTime() - Page_Enter.getTime()) / 1000;
time_dif = Math.round(time_dif);
if ((time_dif <= TimeLimit || TimeLimit == 0) && Page_ShowPopOnExit == true) {
display('');
createCookie('NoPopup', '1', '1');
}
}function LinkConvert() {
var href;
var anchors = document.getElementsByTagName('a');
for(var y=0; y
href = anchors[y].href.toLowerCase();
if (!(href.indexOf("http://") != -1 && href.indexOf(MySiteDomain) == -1)) {
anchors[y].clickhandler = InternalLink;
XBrowserAddHandlerPops(anchors[y], "click", "clickhandler");
}
}
}XBrowserAddHandlerPops(window, "load", "PageEnter");
XBrowserAddHandlerPops(window, "unload", "SiteExit");
if (Page_ShowPopOnClicks) {
XBrowserAddHandlerPops(window, "load", "LinkConvert");
}</script>
Customizing the exit console URLs
The exit console code above can point to either one single URL or it can point to a random URL from a list you preset. Either way, the URL(s) are stored in the $exitpages variable, right at the top of the source code. If you wish to have one single URL for the exit console, set one URL in the Array; if you wish to have a list of URLs and the script to pick a random one, add multiple URLs in the Array; the script will find in there.
Time limit – making the exit console pop only if the visit was too short
By default, the source code above will make the exit console pop no matter how short the visitor stayed on your website. However, you may wish to tweak that value and set it to a number of seconds. More exactly, if you wish the exit console to pop only if the visit was shorter then 10seconds, then you would set the value of the TimeLimit variable to 10. In this scenario, if the visitor lands on your website and tries to navigate away from your website in less then 10seconds, the exit console pops up; if the visitor spends some time on your website, say 30 seconds or whatever, the exit console will then no longer pop.
The theory behind this settings is that if a visitor takes his time to look at the website, reads around and looks at your content, it is pretty much useless to keep poping windows on him, since he seems rather not interested in the content type or the content itself and he is navigating away even after taking a thorough look at the content. Either way it is up to you.
When to show the exit console
The Page_ShowPopOnExit and Page_ShowPopOnClicks variables can be set to either true or false. They decide when the exit console is supposed to popup: on page exit/close and on outbound clicks respectively. By default these are set both to true.
How do we pop and display the exit console
The function display handles the poping and display of the exit console. You can customize the code inside it to make it more advanced. There are different techniques out there that allow a cross browser popup to be displayed. By cross browser, I mean the popup will work on any visitor browser, since various browsers need various code to do that. Also, on the lately popup blockers spread, it seems harder to make a successful code that will popup on every browser AND every popup blocking software the visitor may run.



