anks Posted August 21, 2011 Share Posted August 21, 2011 Folks, When someone click on a link on my webpage and if that Link takes the visitor off my site, then i want to make an entry in my database. But if that link goes back to some other link in my Site then i do not want to Count that link. So, is there any code that lets me detect any outgoing link Click? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/245349-php-code-to-detect-external-outgoing-link-click/ Share on other sites More sharing options...
JasonLewis Posted August 21, 2011 Share Posted August 21, 2011 You'd need to run all links through a script that detects if the link is to a document in your page. www.yourwebsite.com/out.php?l=encodedurlhere Facebook does this, and I believe they use JavaScript to determine if the URL is external and if so adds a click event to that link that prevents the link from taking users to the direct location but instead redirects you through a script that probably logs the action. Quote Link to comment https://forums.phpfreaks.com/topic/245349-php-code-to-detect-external-outgoing-link-click/#findComment-1260113 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.