1

I need to build a Google Analytics filter that includes all traffic from a selection of subdirectories, in my case all that start with customer and company.

You can see my configuration below, but the basic pattern is this:

/customer|/company

enter image description here

According to the Google help file one should be able to pipe together multiple patterns: https://support.google.com/analytics/answer/1034832?hl=en

But this clearly does not work. Any idea how to achive this?

Update: I've tried @nyuen suggestion, but getting zero visitors like this. Do I have to switch to a custom filter?

enter image description here

Solution:
Customer filter with include was the solution. enter image description here

1 Answer 1

1

There are a couple of issues that I immediately see:

  1. Subdomain is not the same as subdirectory. A subdomain looks like company.domain.com or customer.domain.com. A subdirectory looks like www.domain.com/customer or www.domain.com/company.
  2. If you are talking about subdomains, then you should use a regex match on a hostname of (customer|company)\.domain\.com. If you are talking about subdirectories, then you should use a regex match on a page path of /(customer|company)/.*.

Note that you can't use the begins with match type with a regular expression as you have in your example.

6
  • Thanks! I'm looking about subdirectory. Sorry for this. I fixed the question. But it's still not working.
    – Remy
    Commented Dec 12, 2016 at 10:26
  • Sorry I'm not at my computer right now and I can't check, but try a Custom filter with your regex pattern.
    – nyuen
    Commented Dec 12, 2016 at 14:37
  • 1
    Also note that to page paths (and subdirectories) are referred to, in custom filters, by "Request URI".
    – nyuen
    Commented Dec 12, 2016 at 17:57
  • Request URI only contains the subdirectory? Not the whole URL? I'm still facing the issue that subdirectories like e.g. "/en/company/jobs" are also caught.
    – Remy
    Commented Dec 13, 2016 at 8:25
  • I saw your Solution above in your post, is everything OK now?
    – nyuen
    Commented Dec 13, 2016 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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