1

I am using Google Analytics SpreadSheet Addon to get data in Google Sheets.

I took reference to this Google Analytics API V3 documentation for filter operators. I am using RegEx to filter data.

Everything works well, till I am within limit of 128 characters in RegEx. The below RegEx works pretty well.

ga:pagePath!~((me.|account.|member.|)example.com.*|sortfield)

In the above expression, I also want to filterout 8 specific URls starting with www.example.com so I have to add their path. This makes the expression length longer than 128 characters. It is mentioned that I can use OR(,) or AND(;) operator to combine more than two regEX in order to avoid 128 characters limit.

So I created this RegEx for example:

ga:pagePath!~((me.|account.|member.|)example.com.*|sortfield)\,ga:pagePath!~specific-url1|specific-url2|specific-url3|specific-url4\,ga:pagePath!~specific-url5|specific-url6|specific-url7|specific-url8

However, when I run the report, Google by-passes the entier filter expression; and return full report without any filters. (This contains 50,000+ records)

I tried with various combinations in RegEx - like I used !@, != also tried to avoid adding backslash "\" to by-pass "comma ," but it doesn't work.

So what can I do to run the above script correctly?

2

Your filter translates to this statement:

All pages, that do not match RegEx A OR do not match RegEX B OR do not match RegEx C

This essentially returns all or most of your pages, as one of the sub-conditions are likely to evaluate to TRUE, resulting the whole filter to be passed by pages.

So for you regex to work, you need to tell Analytics to match all these conditions at the same time, with AND operator (;) instead OR (,).

  • awesome man.. thanks much for your inputs. This works like a charm. – Bhargav Joshi Apr 10 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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