6

In one of my url, www.mycompany.com/accounts, I show different content based on the hash. e.g. www.mycompany.com/accounts#profile shows user profile and www.mycompany.com/accounts#subscription shows the current subscription of the current user. It is implemented with Backbone.

When I search for www.mycompany.com/accounts#profile, I yield nothing. I am pretty sure this url is accessed by different users every day.

enter image description here

Is it a limitation of google analytics? If so, how can I track this sort of behaviour?

1 Answer 1

6

The term you're looking for is URL fragment, i.e. anything after the # symbol.

Google Analytics does not track it by default, from what I understand, although I can't find actual GA documentation confirming this.

In Google Analytics, fragment changes are not tracked by default, and the URL paths that are passed to GA with your Pageview hits are stripped of these fragments. With Google Tag Manager, this can be remedied with a History Change Trigger and some Variable magic.

Thus, www.mycompany.com/accounts#profile is tracked as www.mycompany.com/accounts and hits aggregated with the same URLs with different fragments.

The link above has some useful tips as to how to get fragment tracking working.

2
  • turpachull's answer above is absolutely correct. URL fragments are not automatically tracked with GA. However, you can track those "virtual pageviews" if you use Google Tag Manager. You will have to create a custom variable to track the fragments as pageviews.
    – miglpz
    Commented Mar 23, 2017 at 22:22
  • 2
    Tracking "virtual pageviews" is a built-in feature of GA, but you have to configure it, here's the documentation: developers.google.com/analytics/devguides/collection/… (apparently, allowAnchor is built-in as well), Google Tag Manager just makes it easier to implement.
    – adam-asdf
    Commented Mar 24, 2017 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.