3

I have a website where an URL-scheme like www.domain.com/#user=1 does get used. This scenario is happening for 2 months now and we have some views each day (enough to track them). If we now check in Google Analytics we see none of these pages listed although we have verified >50 views per page/ day.

We have no filters set at all. GA is installed with gtag.js. And on another project I have exactly that scheme that gets tracked correctly although we have way less views there per page

that's how it should work

What am I missing there?

5

Google Analytics does not track the hashtag (URL fragment) by default.

You can update the data before sending it to Analytics (track pageviews).

gtag('config', 'GA_TRACKING_ID', {
  'page_path': location.pathname + location.hash
});

Or you can use Google Tag Manager.

The data you are showing with the URL fragment on Analytics must have one of them implemented. Also check AllowAnchor in case it's being used on this view.

  • 1
    This will not work without refreshing the page. If the hashtag is added on the page path after clicking an anchor link the gtag will not track this as a PageView. Will track it only if the hashtag is part of the page path on the initial page load. You need Google Tag Manager to track this behavior. – TheodorosPloumis Nov 7 '18 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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