Theme and Page A/B testing

Hi,
I would like to know if there is another way to handle AB testing of theme and page then just switching the theme and page every X time ?
Is there a way to modify the routing system of a shop to randomly see one theme or another, same question for a page ?

Thank you.

You can pass ?view=[template name] in the URL for a page to present a different template for a page.

E.g. www.myshopifystore.com/pages/pageA?view=pageBtemplate

The problem with this solution is that is not dynamic.
I would like that if my user use my app and set a A/B testing on /product-x page for example.
He just have to set one another page and my app auto redirect user either to one or the other page.