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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:03:32+00:00 2026-05-30T13:03:32+00:00

I have outbound links like this in my html: <a href=http://www.example.com class=gaLink1 target=_blank onCLick=ga_track_link(‘action’,

  • 0

I have outbound links like this in my html:

<a href="http://www.example.com" class="gaLink1" 
target="_blank" onCLick="ga_track_link('action', '123', 'abcde', 'fghij')"> 
<img src="http://www.example.com/image.jpg" alt="image name" height="180" style="max-width:153px;max-height:150px;" />
</a>

So, When there is a click on this image, the link http://www.example.com should open in a new tab, since there is target=”_blank”. Also, the onCLick event will call the function ga_track_link which is defined as:

function ga_track_link(action, id, name, source) {
    _gaq.push(['_trackEvent', 'category 1', action, id+': '+name]);
    _gaq.push(['_trackEvent', 'category 2', 'example', source, 15]);
}

This function is defined in the script section at the end of the html (inside the body section)

I’m observing in GA, there both events are tracked (category 1 and 2), but the amount of times that both are tracked is not equal. Category 2 appears almost half of times, which makes me think that the 2nd event is not always being fired.

I found this link http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55527
that suggests to put the function “ga_track_link” in the head section of the html and use a return False in the onClick function.

According to some other answers like When and why to 'return false' in JavaScript? , the return false statement would tell the event (onClick) not to be fired, which is not what I want, since I do want it to be fired but after my 2 GA events were fired.

So, I have 3 questions:

1) Is there any problem firing more than 1 GA event (with _trackEvent) on 1 click? What is the best way to do it?

2) Why Google Analytics link above states that the function should be placed in the head section of the html?

3) Can someone please clarify the “return false” statement’s goal and how to use it correctly?

  • 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-30T13:03:33+00:00Added an answer on May 30, 2026 at 1:03 pm

    1) Is there any problem firing more than 1 GA event (with _trackEvent) on 1 click? What is the best way to do it?

    No, no issue with that although you could do both with one push. One Push, Multiple Commands

    2) Why Google Analytics link above states that the function should be placed in the head section of the html?

    Because the user may click the link before the javascript has time to load on the page.

    3) Can someone please clarify the “return false” statement’s goal and how to use it correctly?

    My understanding is that it prevents the default behavior of the element and if listed after your function call it should have no effect on that function call. This is just as stated in one of the answers to the question you cited:

    <a href="#" onclick="doSomeFunction(); return false;">
    

    In the Google Analytics support link you provided, the return false; is stopping the link from immediately sending the user off the site. It runs the tracking function before hand and then redirects the user to the external site after a delay. This allows the tracking code the time needed to be sent off before the redirect.

    function recordOutboundLink(link, category, action) {
        _gat._getTrackerByName()._trackEvent(category, action); //set tracking
        setTimeout('document.location = "' + link.href + '"', 100); // redirect to external site after delay
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
Presently i have the following code on one of my web page- <a href=http://ex.com
I have added the code as listed on this page ( http://support.google.com/analytics/bin/answer.py?hl=en&answer=1136920 ) to
I have a Perl code that use threads and HTTP::Async with multiple outbound IP
I am using this , and I have it tracking an outbound link, but
i have put that url http://pvpcoach.com/notification.php in Instant Payment Notification setting in my profile
I've got an ASP.NET MVC 3 web application that lives on server 1: http://www.mysite.com
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
I have an existing Workflow Rule that fires of a (SOAP) Outbound Message when
I have the following URL in mind: /restaurants/italian/miami.html /restaurants/italian/miami-p2.html Using these routes routes.MapRoute(null, {category}/{branch}/{city}-p{page}.html,

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.