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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:08:22+00:00 2026-05-23T02:08:22+00:00

The official suggestion for tracking outbound links with (the asynchronous version of) Google Analytics

  • 0

The official suggestion for tracking outbound links with (the asynchronous version of) Google Analytics is to push an tracking event into the queue, like:

gaq.push(['_trackEvent', 'Outbound', 'http://foo.bar/']);
setTimeout('document.location = "http://foo.bar"', 100);

Would it not be better to push an anonymous function into the GA queue, like:

gaq.push(['_trackEvent', 'Outbound', 'http://foo.bar/']);
gaq.push(function() { document.location = 'http://foo.bar/'; });

In the setTimeout version, there’s no guarantee that the event will be processed before the redirect occurs, whereas in the second version, it would only redirect after the event is processed—right?

  • 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-23T02:08:22+00:00Added an answer on May 23, 2026 at 2:08 am

    The problem with doing your suggestion is that it wouldn’t have time to do the request before the page changes.

    The browser won’t wait for those 2 events to be complete before navigating the user onwards. If you are familiar with jQuery, it would be similar to adding a click event handler to a link, adding an ajax request to that handler, but not putting an event.preventDefault() in there. In other words, the ajax request would not be handled as the user has already gone to the next page.

    edit as you mentioned in the comments, this is irrelevant if you apply return false to the links as well.

    If you can actually push a function like you illustrated in your example, I really don’t see why it wouldn’t work better then, with the exception that the first request is timing out for some reason, making the user wait far beyond the 100ms they usually would.

    What about the users that have google blocked? There are lot of addons/programs etc which can completely block out google analytics, adsense etc. will those users have normal user experience?

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

Sidebar

Related Questions

Official guide says: Tomcat deployment is trivial and requires copying the WAR file into
Official appengine documentation says that if we set threadsafe property to true in app.yaml
I read in Sun official documentation (or Sun online tutorial) about dotted naming for
I've read the official guide about different densities and resolutions, but cannot find how
I followed official tutorials to install FOSUser then SonataUser bundles and my app/Application/Sonata/UserBundle/Entity extension.
What is their official position towards clojure?
Aside from the official GWT blog, which GWT blogs do you read?
This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName');
Is there an official Visual Studio test project template for NUnit? If not, what
On the official Selenium blog ( http://seleniumhq.wordpress.com/ ) it mentions that Maven is no

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.