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 751717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:41:55+00:00 2026-05-14T14:41:55+00:00

I am attempting to figure out why this click tracker isn’t working. The code

  • 0

I am attempting to figure out why this click tracker isn’t working. The code was written by another developer so I am not entirely sure if this ever did work.

function trackSponsor(o, p) {
        (new Image()).src = PATH_BASE + 'click/' + p + '/' + o + "?_cache=" + (+(new Date()));
    return false;
}

From what I can gather is that when this function is called it ‘creates a new image’ to fire a php script asynchronously. According to Firebug, the request is made however it is ‘aborted’ ~30ms in. The odd thing is that it will ‘sometimes’ work as in 1 in every 10+ regardless of the browser.

I would much rather fix this so that it works instead of re-writing it as an ajax request.

Any help is appreciated.

Thanks in advance.

EDIT

Because of tvanfosson’s post that got me thinking. I have included the line which calls the click tracker below.

<a onclick="trackSponsor(60, 15077); goToNextStep(1988, 15077, 0); return false;" href="#">view</a>

the goToNextStep() actually changes the page. I am under the impression that it would only be executed after trackSponsor() had finished.

  • 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-05-14T14:41:56+00:00Added an answer on May 14, 2026 at 2:41 pm

    It’s actually pretty trivial to rewrite as a get request using jQuery. Rewriting it will certainly help the next developer understand what’s happening and might fix your problem. I’d need to know more about the contents of the variables — perhaps they need to be urlEncoded? — before I could help you any more on it. You might try urlEncoding them and see what happens.

    function trackSponsor(o, p) {
        var url = PATH_BASE + 'click/' + p + '/' + o + "?_cache=" + (+(new Date()));
        $.get(url); 
        return false; 
    }
    

    EDIT: you might want to check that another handler isn’t redirecting the browser to a new location when the event triggering the tracking is invoked. This would abort any pending requests on the page — and might allow a few to succeed based on the timing of the requests and if the results are delivered before the page is unloaded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 367k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer UPDATED: DEMO http://jsbin.com/itivu3 SOURCE http://jsbin.com/itivu3/edit NOTE: taking in mind what… May 14, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer Nope, you can only submit one form at a time.… May 14, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer use yourNumericUpDown.Select(desiredPosition,0) May 14, 2026 at 5:02 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.