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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:56:18+00:00 2026-05-20T15:56:18+00:00

This is a nasty one. I have an external link. <a href=http://www.example.com target=_blank> now

  • 0

This is a nasty one.

I have an external link.

<a href="http://www.example.com" target="_blank">

now I want to track a Google AdWords conversion every time that link gets clicked.

To do that, I add a click event that loads a Google image. The image counts the conversion. To make absolutely sure the image gets loaded before the user leaves, I use the image’s load event to proceed to the original link’s target.

$("#linkname").click(function() {

 var element = document.createElement("img");
 element.onload = function() { ..... };
 element.setAttribute("src", "http://www.googleadservices.com/....");
 document.body.appendChild(element); 

 });

This will work fine using location.href. However, it won’t work for target="blank" links.
I’m baffled as to what to put into the onload function in order to open a new window.

  • I can’t use window.open because it will be caught by pop-up blockers (Because it’s located in the image’s onload event, it looks like a purely programmatical call that has nothing to do with the link being clicked.) Also, calling window.open without any options does not give me any controls in Google Chrome.

  • I can’t make the click event continue its normal course because I have to wait until the image is loaded, which is an asynchronous operation!

What I would need, essentially, is a way to open a target="_blank" link programmatically, something that may not be possible because it could be circumvented by pop-up-blocker-breakers.

Alternatively, I would need a way to reliably count hits while letting the link’s original click event continue as it’s supposed to.

Does anybody have an idea what to do?

  • 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-20T15:56:19+00:00Added an answer on May 20, 2026 at 3:56 pm

    Since the link opens in new window, you don’t really have to wait for the image to load. Let the image load in the current window (as is being done) and let the user see the new window as normal. It would be very unlikely that the user can close the window before the image is loaded, thus the count would not be disturbed.

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

Sidebar

Related Questions

This one is nasty complicated to solve. I have a table containing date ranges,
This is a nasty one for me... I'm a PHP guy working in Java
I had this nasty bug that disappeared in the past but now after quite
I've got this nasty problem where sending multiple, large messages in quick succession from
We have a nasty little problem. In short we can detect if a screen
So I have been writing to Environment.SpecialFolder.ApplicationData this data file, that upon uninstall needs
I can think of some nasty inefficient ways to accomplish this task, but I'm
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,
This is kinda oddball, but I was poking around with the GNU assembler today

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.