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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:55:30+00:00 2026-06-11T23:55:30+00:00

I am trying to track my pages via google analytics, here is my code

  • 0

I am trying to track my pages via google analytics, here is my code

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXXXXXXXX']);
_gaq.push(['_setDomainName', 'somesite.com']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

(function ($) {     
    // Log all jQuery AJAX requests to Google Analytics
    $(document).bind('ajaxComplete', function(event, xhr, settings){ 
        console.log('ajax Request');
        console.log(settings.url);
        _gaq.push(['_trackPageview', settings.url]);
    });

})(jQuery);

On each ajax request I can see the console has values

ajax Request
url of the page

it means _gap.push is working (as there is no js error on page). But when I am checking my req/res via Live HttpHeaders there is no req/res to google analytics, How to track it?

here is the screenshot in firebug
enter image description here

  • 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-11T23:55:32+00:00Added an answer on June 11, 2026 at 11:55 pm

    The point in _gaq.push is that, until Google Analytics is actually loaded, “_gaq” is just a normal array. That is: the lack of errors is indeed expected, regardless of whether or not it is “working” in the sense of triggering a request to Google.

    The way Google Analytics works is not via ajax (or at least, there is no specific implementation detail regarding how the request will be sent). The method usually used is to create an Image element with the tracking data included in the query string of that image’s URL. After all, the page doesn’t care what response Google Analytics has, it just wants to send its data and go!

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

Sidebar

Related Questions

I am using Google Analytics Asynchronous tracking code and trying to track clicks on
I am trying to track the outbound links via google analytics, and Google suggests
I'm trying to get Google Analytics to track the specific link in the page
I'm trying to track down an issue in our MFC code that looks like
I'm trying to track down unwanted dirty pages in small binaries on Linux x86.
I have 3 pages that I am trying to track so to speak. The
I am trying to track hits to classic asp pages which are used as
I'm trying to track the page views by inserting only unique values every 24h.But
I'm trying to track podcast data. They told me I have to use a
I am trying to track ip address of hotlinkers using php and htaccess. .htaccess

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.