Hi I have an application and one of it's functions is to split text various elements on a web page. When the visitor clicks on a Call To Action button (there may be more than one on the page) I want to be able to write back to the server the elements that were displayed so that they can analyse which elements have a better Click Through Rate. Is it the Green, Red or Blue Button? Which Title is performing best? Etc... So far I have found putting an onclick() on all of the exit points and a function that uses,: xmlhttp.open("POST","http://localhost:8888/dl/wd.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send("all my data∧ maybe some more"); The Onclick is like this: <div class="cta" onclick="storeStats()"> and I also have it inside a HREF: <a href="outbound link" onclick="storeStats()"> UPDATE: I have edited this post a few times as I debug the situation and it seems I have solved it but I am not sure it is a good solution. If I change the ASync paramter to false everything works correctly. If I leave ASync as true it doesn't work as we leave the page before it has chance to do it. I added xmlhttp.onreadystatechange=function(){ alert(xmlhttp.readyState);} and when the href="#" it alerts 4 times with 1, 2, 3 and then 4, which means all was well. BUT when the href contains a real outbound link it alerts 1 then 2 but then moves away from the page, so it must be doing it before the xmlhttp.send(). The reason I have not redirected the exit points to a PHP file and then onward to the destination is that the outbound links are going back to different tracking software and some of them override the outbound links using cookies, so I want to leave that part alone. Is it bad practise to use ASync as false so it halts progress until my data is written? Or am I doing something wrong so I can use AJAX correctly? Thanks everyone for reading. Andy