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.
_getTrackermethod. – adam Oct 17 '12 at 14:47_getTrackermethod does work, but the new one doesn't. – Dallas Oct 17 '12 at 19:15_getTracker, and to update to non-deprecated code, I want to switch to the recommended_createTrackerin 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