Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:02:00+00:00 2026-06-01T07:02:00+00:00

I need to track outbound clicks from a directory on our site, and would

  • 0

I need to track outbound clicks from a directory on our site, and would like to do this so that the actual url is in the href. Something like:

 <a href="http://www.example.com" id="a24" class="link" >Go to Example</a>

This is the JQuery I’m using below. The click.php file is basically looking up the link id and then inserting the click information into a mysql table.

This seems to work fine even if the click.php takes a long time to complete. In other words, the user immediately links through to the destination url, even if I set the the click.php to sleep for 10 seconds before completing.

I’m using $(‘a.link’).mousedown instead of $(‘a.link’).click When I use .click, then it doesn’t work (the click is not recorded). I’m just curious why it wouldn’t work with using the .click function and only works with the .mousedown function.

Is this a good way to capture the clicks with JQuery or is there a better way? (I realize that anyone with Javascript turned off wouldn’t be counted).

$('a.link').mousedown( function(e){

        var my_id = $(this).attr('id');

        $.ajax({    
          type: "GET",
          url: "/tiger/sal/clicks/click.php?id=my_id"
        });

        return true;

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:02:02+00:00Added an answer on June 1, 2026 at 7:02 am

    You’re not giving jQuery enough time to compute everything before your browser directs. Why don’t you try something like:

    $('a.link').click( function(e){
    
       // Prevent the browser from running away
       e.preventDefault();
    
       // I've changed this to POST to make it a bit more secure
       // You can access the link ID with $_POST['link_id'] now
       $.post('/tiger/sal/clicks/click.php', { link_id: $(this).attr('id') });
    
       // Wave goodbye
       window.location.href = $(this).attr('href');
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to track some information on users, but would like to retain it
I need to track users relations in a social app, something like this: UserA
We need to track the EFFECTIVE time on site of our users Most users,
Suppose I need to track my clicks using google analytics scripts. I know that
I need to Track Unique Visitor count in my web application. I would really
For my application I need to keep track of all files that are touched
I have a Flex Application, and I need to track site catalyst data with
I need to track where is thread that in Eclipse debugger seen as: Warning-123
I need to track changes (additions and deletes) of an association set up like
I need to track issues in libraries that are shared between multiple projects. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.