Jump to content

PHP Code to detect External Outgoing Link Click


anks

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.