martynj.com - things I have learnt

Google Analytics _setAllowAnchor(true) doesn't enable recognition of arbitrary hash # values in URL

I just tried using Google Analytics _setAllowAnchor() to capture URI parameters that appear after a hash # in the URL. The __utm.gif ping back to Analytics holds the page URI in its utmp parameter. Pageviews with a hash parameter in the URI were reported in the same way, without the hash value included, by __utm.gif utmp both with and without setting _setAllowAnchor(true);

Seems that setAllowAnchor() only enables campaign parameters to be recognised after the #, not arbitrary values.

UPDATE: On further testing, it seems that GA can be forced to recognise full URIs including parameters after a hash (#) character by making a virtual pageview.

eg. pageTracker._trackPageview('uri/including#params=here');

Tagged: google analytics

blog comments powered by Disqus