Howdy,
I'm trying to write an outbound link tracking script using Ajax. The problem I'm having is the links are only being recorded by the backend PHP script half the time. I think the problem is the page moves onto the link's location before the Ajax script has had a chance to send the information to the backend scripts. I've had the same problem using other types of JavaScript tracking, and I've inserted a short pause before the browser moves onto the link location, to give the script time to do it's thing.
Is there a way to keep the browser from moving onto the link's location until the Ajax script get a response from the backend? I tried creating a function for the Ajax script to call when it gets a response, and then it uses window.location to send the browser to the link's location, but for various reasons that's not satisfactory.
Start Free Trial