Mobile app version of vmapp.org
Login or Join
Angie530

: What causes Google Analytics tags to work on some machines but not on others? The title of this question says it all. I am trying to update my code from the deprecated _getTracker() method

@Angie530

Posted in: #GoogleAnalytics

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.

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

4 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

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. :)

10% popularity Vote Up Vote Down


 

@Sent6035632

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).

10% popularity Vote Up Vote Down


 

@Si4351233

_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?

10% popularity Vote Up Vote Down


 

@Murphy175

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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme