I hope you can help me.
I have a gallery in Javascript. Each picture has a specific hash.
www.example.com/gallery.html#title_1
My stats are on Google Analytics but hash doesn't exist even when I tried this in the respective code :
_gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);
or this :
_gaq.push(['_setAllowAnchor', true]);
Any idea to solve this problem ?
Thanks for your answers.
_setAllowAnchor
is for a completely different use case.The right way to do it is as you said:
But you need to execute this after the hash has changed. I think you are executing this when the page loads. When the hash changes the page doesn't reload so you need to run this function call explicitly again.