Reputation: 1
I'm trying to figure out how I can track certain pages within a website, which open on click within a page with URL 12345.com and look like 12345.com#54321 (different endings). GA cannot be seen on these pages. Is there a way to track these pages?
Upvotes: 0
Views: 762
Reputation: 774
Google analytics does not track anchor links out of the box, you will need to edit the tracking code.
Try the following
If using Universal analytics.js, edit from this:
ga('send', 'pageview');
to this:
ga('send', 'pageview', {'page': location.pathname + location.search + location.hash});
If using gtag.js, edit from this:
gtag('config', 'UA-XXXXX-Y');
to this:
gtag('config', 'UA-XXXXX-Y', {
'page_path': location.pathname + location.search + location.hash
});
Upvotes: 1