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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:11:34+00:00 2026-06-18T21:11:34+00:00

I am adding a Google Analytics tracking event to nav menu links, with this

  • 0

I am adding a Google Analytics tracking event to nav menu links, with this code:

(function ($) {
    "use strict";
    $(function () {
        $("body").on('click', '.menu-item a', function () {
            var trackingCode = $(this).next(".ga-tracking");
            if (trackingCode.length > 0) {
                var t1 = trackingCode.data("tracking-1"),
                    t2 = trackingCode.data("tracking-2"),
                    t3 = trackingCode.data("tracking-3"),
                    t4 = trackingCode.data("tracking-4"),
                    params = "'" + t1 + "','" + t2 + "','" + t3 + "'";
                _gaq.push([params]);
            }

        });
    });
}(jQuery));

you can see it working here: http://paulwp.com/blog/
to trigger the code, click on the Blog link in the top black bar.

This is the error I get:

_gaq.push processing "'_trackEvent','Store_Outbound','Link_Click'" for args: "[]":  

Called method "'_trackEvent','Store_Outbound','Link_Click'" threw exception.TypeError: Cannot call method 'apply' of undefined 

whereas it should give something like this:

_gaq.push processing "_trackEvent" for args: "[Store_Outbound,Link_Click]":  

guess it’s the way I build the parameters with the variables that’s causing the issue

  • 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-18T21:11:35+00:00Added an answer on June 18, 2026 at 9:11 pm

    You are passing the values wrong. This is effectively what you are doing:

    _gaq.push(["a,b,c"]);

    That is an array with a single element.

    This is what it should look like:

    _gaq.push(["a","b","c"]);

    This is an array with multiple elements.

    So basically you need to do

    params = [t1,t2,t3];
    _gaq.push(params);
    

    or just put them directly in:

    _gaq.push([t1,t2,t3]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use Google Analytics but I am concerned about adding more
I am implementing Google analytics onto a ecommerce site. We are already tracking events
Below is the code I keep trying; I'm basically just trying to use this
Possible Duplicate: How to use Google Analytics with Phonegap without a plugin? I want
I'm adding Google Translate links to my website, but I want to run some
I am creating a .NET page specifically for firing a Google Analytics event. The
When I am adding a Google Map marker using this tutorial, I am able
I'm adding Google Analytics to my armv6/armv7 project and I get a linker error
I just noticed something really nice on the Google Analytics signup page for adding
I've installed Google Analytics on my website, and I want to now use '

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.