Combining similar URLs in Google Analytics

2019-01-28 14:00发布

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条回答
放我归山
2楼-- · 2019-01-28 14:55

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.

查看更多
登录 后发表回答