Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

The title of this question says it all.

I am trying to update my code from the deprecated _getTracker() method to _createTracker(), but am experiencing inconsistent results. I have tried both traditional and Asynch methods (using a JSP include), but they all have the same result. My pageviews, and others in the office all show up in analytics, using both methods. The client visits from their own machine are not showing up. I have tried various test cases, but their visits using _createTracker( ) just do not register at all for them, and mine do. Visits from their machines using _getTracker ( ) do show up.

They have tried on multiple machines, and I have walked through with them step by step, so I know it's not just user error. I have verified that independent computers elsewhere (outside my network) do have their visits tracked, so I am extremely confused why their visits are not showing. It's also frustrating to show that the new tags work for me, but just not on their machines.

I know that if someone has javascript turned off will cause the tags not to work, but I am wondering if what else might cause their visits to not be recognized? I would appreciate any suggestions.

Currently trying this code: (Successful in all my test cases, but not client machine)

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
_gaq.push(['_setAllowLinker', true]);
_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);
})();
</script>

Tried this (also successful but not on client machines)

<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
    var pageTracker = _gat._createTracker("UA-xxxxxxx-x");
    pageTracker._setDomainName("myurl.com");
    pageTracker._trackPageview();
</script>

This is the old code that still works on client machine:

<script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
    var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
    pageTracker._initData();
    pageTracker._trackPageview();
</script>

UPDATE: So I did some more tests today, and the original tags are NOT working on the client machines now. To be clear all three versions are working in all other tests, so it seems not to be the code itself. At some point in the last month, something changed. I will check to see if it's their network or something on these two machines... but my question still stands... what on their machines might cause this. All answers are still appreciated as to what exactly I might examine to narrow down, and the first clue to lead me to the issue will not necessarily get the rep. If two or more answers are similar, but one explains it more correctly and/or completely, consideration will be given to what the best overall answer is. I also assume I can extend the deadline if I don't have the correct answer by the deadline, but if not I will make sure the rep goes to the rightful winner.

UPDATE: #1 - I didn't realize that the rep just disappears at the end of the bounty period. <hangs head> I truly thought I would be able to wait until I had an accepted answer. #2 - Things are registering client side. The first code block is what we are using and it works just fine. The issue wasn't the analytics code, but rather something else that has "reverted" back. Not that it matters now that things are registering, but I was able to use the Chrome dev tools to verify the tracking beacon was sent.

share|improve this question
    
I have verified on a machine outside the network, and that visit did register... I am really curious what else, other than Js being turned off, might cause this. I don't think firewall is an issue, as the code using _getTracker() still works on another page for them. –  Dallas Oct 16 '12 at 17:22
    
Is the js script inline or in an external file? Could be over-aggressive caching, meaning that machines with a cached copy were still using the _getTracker method. –  adam Oct 17 '12 at 14:47
    
It is a jspf, so it's a standalone file (server side) that gets brought into the page. Looking at the source (in the browser) it appears to be updated. Also, the _getTracker method does work, but the new one doesn't. –  Dallas Oct 17 '12 at 19:15
    
@Dallas Can you post a link to the library you are using? Why aren't you using the default Javascript tracking code? –  eduardocereto Oct 19 '12 at 6:53
    
I was using traditional syntax for _getTracker, and to update to non-deprecated code, I want to switch to the recommended _createTracker in the recommended Asynch syntax. The problem is that the latter causes visits on two machines not to register. All other tests are successful, so I am trying to narrow down why. JS turned off would do it... but what else? I'll edit my ? to show the before and after code. –  Dallas Oct 19 '12 at 15:03

4 Answers 4

up vote 0 down vote accepted

I really try not to assume things, but in this case it turns out this boiled down to two different understandings of what to do when applying the advanced filter, and the fact that they had an extra field. Assuming you are looking in Content>All Pages and then under the graph, going across you see the primary dimension, secondary dimension, and then you either see a search box with a magnifying glass or don't, then the Advanced Filters.

To cut out prod traffic, we choose a secondary dimension of Host, and then in the filter, include on host includes testdomain.com. The user was typing this into the search box, instead of in the filter dialog, and that was the only reason they weren't seeing results.

For the benefit of anyone else reading this, Chrome and FireFox developer tools both were valuable in confirming the tracking beacon is actually sent, and there are a few suggestions here of where you might look. The GA code itself was all working fine. As to why this Google Analytics field would show up in Firefox, and not Chrome... I would like to know what's up with that. :)

share|improve this answer

I deeply suspect this being a filter issue or a "Track-Me-Not" header being set. In any case, make sure your client's browser is not behind a restrictive proxy/firewall, has no privacy software tools installed or disabled (such as AVG Antivirus) and check the setup in Google Analytics that no filters are in use (such as Exclude IP Adresses).

share|improve this answer
    
I checked in the Admin panel, and there are 0 filters. Care to elaborate on the "Track-me-not header"? Are you talking about the Firefox add on, or the use of a Safari User Agent spoofer-like browser feature? I assume these are all consciously chosen, but if you know of another source that the user might be unaware of, I am all ears. There is no software installed in the last month, and no AVG install. When you say proxy/firewall, advice on how to check this would be appreciated. Am I looking for an explicit firewall/antivirus rule naming the url or domain? –  Dallas Oct 24 '12 at 3:10
1  
The Electronic Frontier Foundation has some information about it here: eff.org/issues/do-not-track. Currently the major browsers support the feature, more info here: mozilla.org/en-US/dnt Also some info about the DNT HTTP Request Header is also available on Wikipedia: en.wikipedia.org/wiki/… Interesting enough, our company has implemented the DNT HTTP Header within our company proxy. So it doesn't matter if our employees tick the box to enable or disable it, the request is always sent to enable DNT. –  DKOATED Oct 25 '12 at 8:02
    
Comment 2 due to character limitation: Another check I'd do is if your client is able to open the ga.js directly. The deeplinks to the Google Analytics script are: ht tp://www.google-analytics.com/ga.js and ht tps://www.google-analytics.com/ga.js. Maybe this is the root of all evil. Chinese have some problems accessing Google's servers. Perhaps a firewall rule on the client side is hindering this as well. –  DKOATED Oct 25 '12 at 8:06

_createTracker(opt_account, opt_name) is a _gat Object according to Google's site it says

The _gat global object is used to create and retrieve tracker ojbects, from which all other methods are invoked. Therefore the methods in this list should be run only off a tracker object created using the _gat global variable. All other methods should be called using the _gaq global object for asynchronous tracking.

Shouldn't you be using _gat?

share|improve this answer
    
I will give this a go (hopefully tomorrow) and let you know. –  Dallas Oct 22 '12 at 22:31
    
So... I added the middle chunk of code to show what I had tried (_createTracker with Traditional syntax), and that did use _gat. Hmm. –  Dallas Oct 23 '12 at 22:23
    
Your answer is correct in content, but unfortunately doesn't get to the root of my issue. I confused things initially by stating that one worked and the other didn't, so I completely understand why you added this answer at the time. Feel free to suggest another answer if you have any other ideas to investigate. –  Dallas Oct 24 '12 at 3:19

Are cookies enabled? Make sure, otherwise I don't think the tracking works very well (it still records page impressions I believe, but can't track someone because it uses cookies for that).

If cookies are enabled, they could also be using a firewall/antivirus software that includes privacy features for anonymous browsing. Are you able to get access to the client machines? I would recommend running something like fiddler2 or Wireshark in order to look at the outgoing HTTP requests on the client machine. See if indeed it's sending requests out to google related to tracking when they hit your site, and that the requests all come up clean (e.g. status 200 or 302 > 200)

If they were using an old browser, it could be that the javascript is causing an error (because of a browser bug). Make sure to try it in multiple browsers on the client machine -- best to just get a fresh copy of chrome/ff/safari or make sure IE and Windows are fully updated (not sure what the client machine is).

Again, if you can get physical access to the client machine in question, I would check the developers console in any browser and verify that (a) the JS is getting written to the document and (b) the ga.js file is being parsed and (c) there are no errors in transfering documents or within the JS itself.

Lastly -- have you added any filters to your account? Personally, I filter out my entire office, since we're more interested in how the public uses our website. Make sure your filters are set up correctly.

EDIT: Also, when looking for outgoing requests, make sure there's one for "__utm.gif". This should be requested by the ga.js script, and is in fact how the tracking works. When google receives a request for __utm.gif, it uses the associated GET/POST vars (probably GET).

share|improve this answer
    
Cookies are enabled. I don't think it's firewall/anti-virus as the old tags still work fine. They are using IE7 (old yes, but that's the level we are supporting back to). I have tested with IE7 and my visits show. I can go and test with multiple browsers with my laptop, that is working, but will not be able to do so immediately. When I do, I will do as you suggest. No filters are in place, or advanced segments being used, to view analytics. –  Dallas Oct 22 '12 at 22:38
    
Well good luck. Yeah, if the old tags work then it's probably not anti-virus... I am pretty much mystified by your problem. It's very troubling that the old code works and the new code doesn't (no typos?). Hope you figure it out –  Kasapo Oct 23 '12 at 16:46
    
Thanks. Copied and pasted to avoid any mistake. I am mystified too...as I mentioned the new code works in all cases so far, except these two machines (so far). Hard to ask someone to sign off on something, even with a mountain of evidence it works elsewhere, when it clearly doesn't pick up their visits. –  Dallas Oct 23 '12 at 17:21
    
So, given the update, firewall/antivirus could be back in the picture. I do know the JS is written to the document. Any advice on how to interpret b) and c)? BTW, are you saying that developer add-ons, like Firefox developer extensions for example, will give details of all outgoing object requests? –  Dallas Oct 24 '12 at 3:16
1  
No -- developer extensions (or built-ins) will just show errors in retrieving things (like the gif image request that google uses for tracking). There might be an extension that logs every outgoing request, but fiddler2 is a stand-alone program that can monitor all outgoing traffic for a given computer. See fiddler2.com for more info. I'd use this to verify that a request IS being sent and received for the tracking image "__utm.gif". Programs like AVG and Symantec sometimes offer "privacy" addins to the browser which often block tracking cookies or ads or mysterious requests to 3rd-party sites –  Kasapo Oct 24 '12 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.