Google Analytics double listing with and without forward slash

回眸只為那壹抹淺笑 提交于 2019-12-23 12:27:44

问题


We are getting double listings on most of our urls in Google Analytics, such as the following:

/Home/Specials

/Home/Specials/

The website is MS MVC3-based. The first usually shows a short loading period with an almost zero exit rate. Most of the real user data is on the second (the ones with the slash suffix).

What is the resolution for hiding the first?


回答1:


The issue is caused by the duplicate tracking done by Analytics itself and the jQuery address script (the latter adds the trailing slash). The jQuery code adds tracking on AJAX posts, so it's useful for pages like search results.

To resolve the issue, we simply removed the following line from the core script provided by Analytics:

_gaq.push(['_trackPageview']);



回答2:


It's also possible to add a regex filter within GA itself which will add slashes internally, effectively eliminating the issue.


From https://www.getelevar.com/how-to/fix-duplicate-url-google-analytics/

How to fix duplicate URLs in reporting

Step 1: Create a new GA view so you can test and validate if this fix works for you before you apply it to your day-to-day view(s)

Step 2: Create a new advanced filter with this regex (screenshot below), which performs this manipulation of your data:

If a URL does not have query parameters at the end of the URL AND is a standalone URL AND does not have a trailing slash at the end of the URL, then add a trailing slash at the end of the URL

Here is the regex for the advanced rule to test:

^(/[a-z0–9/_\-]*[^/])$

Once this has been completed, save your filter.

Step 3: Verify this new filter works as expected.

To test and verify this is working, follow these steps: you can use the Real Time report in Google Analytics to:

In one browser tab go to a version of your site you’d like to test (e.g. yourdomain.com/new-in) In a 2nd additional browser tab go to the version of the same URL with the trailing slash (e.g. yourdomain.com/new-in/) Go to Google Analytics > Real Time Report > Top Active Pages and you should have 2 active pages from the previous steps!



来源:https://stackoverflow.com/questions/11608769/google-analytics-double-listing-with-and-without-forward-slash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!