Callista
Callista

Reputation: 1

Google Analytics Content Experiments: Regular expressions and backreference

I need to setup the experiment as follows:

Original: www.domain.com/original/x?param=something

Variation: www.domain.com/variation/x?param=something_else

Where x is variable and needs to be carried forward to the variation on the redirect.

Is Regular Expression and Backreferences supported by Content Experiment, so that I can do something like:

Original: www.domain.com/original/(.*)?param=something

Variation: www.domain.com/variation/$1?param=something_else

Is there a way I can setup the experiment URLs, the way that I need it to work?

Upvotes: 0

Views: 386

Answers (3)

Callista
Callista

Reputation: 1

I've tried the 2 options of backreferencing ( as suggested by @hwnd ) in the variation URLs:

  • \1
  • $A1

In both cases, the experiments managed to redirect to the variation URL however, both cases were unable to carry over the regex matched group value (x) to the variationi URL.

That means that in order to be able to do Google Experiment, we would have to change the URL format by moving x to the query string. :(

Upvotes: 0

Callista
Callista

Reputation: 1

@hwnd Thats sounds promising, however, I'm not sure what 'Search' and 'Replace' you were referring to.

I was referring to setting up Content Experiment as the title suggested.

Are you saying that I can set up the experiment as follows?

Original Page

Web page to experiment

www.domain.com/original/([\d+])?param=something

Variation 1

Web page to experiment

www.domain.com/variation/\1?param=somethingelse

Is this how I should set it?

Upvotes: 0

Mehdi Khademloo
Mehdi Khademloo

Reputation: 2812

if your parameters have the same name, don't use the Regex for it. Just:

1) Replace("original","variation");
2) Replace("something","something_else");

Upvotes: 0

Related Questions