RegExp Alternative to Negative Match for Google Analytics

I set some conversion sequences in Google Analytics. One of them is to analyze the traffic from the main site to the secondary advertising site working in a virtual directory (in the same domain)

I have to add that this is an installation form in Google Analytics, I cannot use other code (PHP, JS, C #, etc.), and this needs to be done in one step

So, for example, something like:

  • /default.aspx or /directory/default.aspx or /somedirname/default.aspx
  • [to>]
  • /promotion/default.aspx

In the regex area, this will be:

  • ^ / (?! promotion) (. *). Aspx
  • [to>]
  • ^ / promotion /(.*). Aspx

The problem is that Google Analytics no longer supports negative images, so regexp ^ / (! Promotion) (. *). aspx fails. ( Link here, first answer )

Is there any other way to do this?

Many thanks.

+6
regex google-analytics
source share
2 answers

You can take a two-step approach (is this possible in Google Analytics, I have no idea):

  • Replace unconditionally:
    /(.*\.aspx) --> /promotion/$1
  • Replace again:
    /promotion/promotion/(.*) --> /promotion/$1

If all else fails:

  ^ / (?: [^ p] | p [^ r] | pr [^ o] | pro [^ m] | prom [^ o] | promo [^ t] | promot [^ i] | promoti [^ o ] | promotio [^ n]) / (. *) \. aspx
+6
source share

Make a match on "^/promotion/(.*).aspx" and negate the result.

0
source share

All Articles