Combining similar URLs in Google Analytics

依然范特西╮ 提交于 2020-01-10 05:30:05

问题


I have various articles that come in different format types (ex: pdf, html). I'd like to create a filter in my Google Analytics account that will simply take off file types at the end of the article URLs and then combine the same article URLs together, so that I would be able to view the total pageviews for that article from all of its forms. For example, I have several articles, and they may be listed like so:

/site/42/5/1234.html

/site/28/12/5555.pdf

/site/42/5/1234

/site/42/5/1234.pdf

/site/28/12/5555

What I would like to do is combine the pageviews for all of the same articles -- so in this example, the pageviews would be combined into just two URLs: (site/42/5/1234 and /site/28/12/5555.

How would you suggest creating a filter that would do such a task?


回答1:


first I would recommend keeping at least one profile where you keep this information separately; you'll want to know what format people are consuming the articles in so you know what kind of content to create.

Next, you need to create an advanced profile filter. Here's the Google article about them.

And here's a GPF thread about the same question.

To tailor it to your needs, your first field might look something more like this:

(\/site\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]+)($)?|\.html|.\pdf

...Depending on the number of numbers in each folder (I have it set up to accept 1 or 2 numbers like how you have it written). The end part ($)?|\.html|.\pdf says, "match nothing at the end, OR .html OR .pdf"; you could change the specific file extensions to .* to match all file types.

Then just use $A1 as in the example provided for the output; this signifies that you want to use only what's in the first set of round brackets in field A

Sometimes it takes some playing with but it's pretty powerful :)

Real time reports can be your friend to catch what's coming in without having to wait a day to see if it's working.



来源:https://stackoverflow.com/questions/19576951/combining-similar-urls-in-google-analytics

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