-
AuthorPosts
-
February 25, 2016 at 12:59 #6595
SALOU
ParticipantHello,
i use gmediaGallery with photobox. I enable the deeplinking for my gallery in purpose to see via Google Analytics the number of viewers per each photos.
But i notice that GA doesn’t count those URL with the hash.
How can i do ?
Thanks, (and sorry for my english, i hope you’ll understand).
February 25, 2016 at 13:29 #6596Rattus
KeymasterGoogle it: How to track hash change with google analytics.
http://www.trackify.co.nz/blog/tracking-anchor-tag-hashtag-pageviews-in-google-analytics
http://stackoverflow.com/questions/32378607/google-analytics-setting-up-a-pageview-on-hash-changeFebruary 25, 2016 at 13:41 #6597SALOU
ParticipantThank you,
i try to search en Google, but i think i didn’t have the good keyword.
Have a good day.
March 16, 2016 at 14:56 #6731SALOU
ParticipantHello,
i come back to you. I’m always in trouble with this hash thing and Google Analytics.
I manage to configure Google Tag Manager like on your first link you gave to me. This work but only if the page is refresh.
Have you an idea how to count every hash like #photobox124, #photobox125 etc… when the user watch a gallery ?Thank you,
March 16, 2016 at 15:29 #6732Rattus
KeymasterTry add this code to GA script:
window.onhashchange = function() { ga('send', 'pageview', {'page': location.pathname+location.search+location.hash}); };
March 16, 2016 at 16:47 #6733SALOU
ParticipantI don’t know how to add that to my GA code.
I try like this, is it good ?<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXX-XX', 'auto'); window.onhashchange = function() { ga('send', 'pageview', {'page': location.pathname+location.search+location.hash}); }; </script>
March 16, 2016 at 17:15 #6736Rattus
KeymasterI think it should send on page load and on hashchange, so maybe try this:
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXX-XX', 'auto'); ga('send', 'pageview', {'page': location.pathname+location.search+location.hash}); window.onhashchange = function() { ga('send', 'pageview', {'page': location.pathname+location.search+location.hash}); }; </script>
March 16, 2016 at 17:26 #6737SALOU
ParticipantThank for your help.
It seem that the problem is not solve. GA doesn’t count the hash url change as a page view without reloading the page…March 16, 2016 at 17:29 #6738SALOU
ParticipantI found this topic on stackoverflow, maybe we have to add a little bit of code directly into Grand Media Plugin
http://stackoverflow.com/questions/12538115/google-analytics-and-hash-anchor-doesnt-work?rq=1“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.”
-
AuthorPosts
- The forum ‘Troubleshooting’ is closed to new topics and replies.