My problem is that Magento will serve the same product pages from multiple different URLs. Some have long directory paths, some are served from the root directory. As far as I can see, there is no obvious pattern in the URL which could be used for Optmizely targeting. There's certainly nothing as simple as /product/ or even anything consisent such as 'ends with 6 digits, followed by .htm'.

When we're grouping these pages in Google Analytics we have to daisy-chain a series of hard-coded rules.

Does anyone know of a way round this, please? I'm hoping this is a fairly common problem and maybe there's an obvious solution which has not yet occurred to me.

If there really is no solution to this, then I will turn this into a feature request. For example, maybe we could add a specific control code to pages on sites to explicitly identify groups of pages for Optimizely.

In our case we could do that at the same time as adding the GA code for explicit grouping:

The feature that you're requesting already exists. It is called a custom tag. Globally target the pages on your site, then limit the page scope via an audience with a custom tag. Read more about it here:

In short, the module places the Optimizely snippet in the head of your site, has revenue tracking built in, and places custom tags on all Magento page types, including Product pages, Category pages, CMS, etc. It even adds custom tags for which categories the products fall into.

Super easy and does all the work for you! Let me know if you have any quesitons about the funcionality - I use it on all Magento sites I work with.

Thanks, Megan. That's extremely useful. I did not realise that the extension also added custom tags. I found that point in the release notes, but it's not immediately obvious on the overview page, which just refers to the ability to run advanced targeting tests. I think it would be good to add the specific point about Magento page types to the overview.