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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:06:16+00:00 2026-06-05T14:06:16+00:00

I am trying to track the outbound links via google analytics, and Google suggests

  • 0

I am trying to track the outbound links via google analytics, and Google suggests using this:

<script type="text/javascript">
  function recordOutboundLink(link, category, action) {
    _gat._getTrackerByName()._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100);
  }
</script>

Which is fine, except, my outbound links are to be opened in a new tab, and I am (naturally) using a target="_blank" for that..

but, the setTimeout method takes that away, and opens the link in the same page..

I’ve tried using window.open() but I am worried that it will be blocked by browsers..

So, is there anyway that I can execute this js function, and delay the click for just a little while? (100ms as google suggests)?

Thanks.


I’ve looked at other questions like this on SO, but they don’t deal with opening in new tab/window.

  • 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-05T14:06:18+00:00Added an answer on June 5, 2026 at 2:06 pm

    Ok to evolve the answer above here is a Jquery plugin that can provide listen a selection of links (based on your own criteria) and provide you a method for callback to them.

    fiddle

    So in the OP’s case the setup could look like:

    <a href="http://www.google.co.uk" target="_blank" data-category="Outbound">Google</a>
    
    $(document).ready(function() {
        $('a').trackOutBound(null,function() {
            var category= $(this).data('category');
            _gat._getTrackerByName()._trackEvent(category, $(this).attr('href'));
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to track clicks via Google Analytics that do not result in a
I'm trying to track clicks in the Spotify Play Button iframe using Google Analytics,
I'm trying to track an event in my app using Yahoo Web Analytics. The
I'm trying to track download clicks with Google Analytics but nothing shows up in
I am trying to track ip address of hotlinkers using php and htaccess. .htaccess
I'm trying to track down a memory leak in a java process, using jmap
I trying to track down the cause of an OutOfMemory for a website. This
I am trying to track a set of keywords from Twitter by using the
I've been trying to track this down for a while but I'm at a
I have been trying to track down some sample applications that are using Castle

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.