Optimizely - How to access the variation name

395 views Asked by At

I am trying to create a goal in optimizly.

I have a product page product.php where someone selects a product via a radio button. That POSTS the data to the cart page. There are 3 variations plus the original one so 4 variations in total.

The data is posted something like below

cart.php?id=277

There's just 3 id's so lets say the ids are 277,278 and 279

Now i have created the variations without issue. I now want to setup a goal on the cart.php, the goals will be:

Product 277 added to cart
Product 278 added to cart
Product 279 added to cart

But essentially there will be 12 goals because there will be:

Product 277 added to cart via original Product 277 added to cart via variation 1 Product 277 added to cart via variation 2 Product 277 added to cart via variation 3

Is there a way to do this with the custom goal or is it only possible via the API? I found the documentation on their site a bit confusing and couldn't find anything specifically related to this, been waiting a few days for a reply from their support with no reply.

1

There are 1 answers

2
TomFuertes On BEST ANSWER

You should actually just code 3 goals (one for each product) or even a single goal ('add to cart clicks') and then do the pivoting in the reporting section where it will break everything out by variation (see screenshot).

That said, optimizely.variationNamesMap[1234567890] where 1234567890 is the experiment ID (pull from the querystring on the edit page) will allow you to access your variation names in the code.

Shows how you pivot by variation