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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:24:49+00:00 2026-06-02T19:24:49+00:00

Suppose I need to track my clicks using google analytics scripts. I know that

  • 0

Suppose I need to track my clicks using google analytics scripts.
I know that standard approach to ensure that tracking event was fired is to pass continuation into the tracking queue and return false from click event handler, like this:

 $('a').click(function () {
    var url = $(this).attr('href');
    _gaq.push(['_trackEvent', smth]);
    _gaq.push(function(){ document.location = url ;}
    return false;
});

My challenge is that I want to open this link in new tab.

My perfect solution is target=”_blank”, but you cant do it with javascript.

window.open(url,’_blank’) will popup new window in all browsers except firefox and this window is usually blocked by default.

This means that I must return true from the click handler.

So this is my reason behind the fact that i need to wait synchronously in some way for ga script to request it’s tracking pixel.
Is some sort of What is the JavaScript version of sleep()? function can help me?

Thank you!

  • 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-02T19:24:50+00:00Added an answer on June 2, 2026 at 7:24 pm

    The only reason you want to ensure the tracking pixel is fired off before visitor is taken to new page, is for links that take you to a new page within the same window. In other words, you want to make sure the tracking code does its thing before the current window is unloaded.

    If your link is opening a new window…regardless of how you are opening the new window…you don’t need to worry about this sort of thing, because your current window is not being unloaded.

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

Sidebar

Related Questions

Suppose I have 10 points. I know the distance between each point. I need
Suppose I have ActivityA and ActivityB, also suppose that ActivityA is active. I need
I'm using ASP.NET 3.5. I made a form that when the user clicks a
I have an embedded system that currently keeps track of seconds until an event
Suppose I need to break out of three or four nested for loops at
Suppose we need to check three boolean conditions to perform a select query. Let
Suppose I need to construct a tuple of length three: (x , y, z)
Suppose you are calling a function, where there's clearly a need to break down
Suppose a query select * from employee returns 80 rows. I need to display
Suppose I have an array of nodes (objects). I need to create a duplicate

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.