I am trying to implement A/B test framework where it should allow to change(test against users) any content on any page dynamically(without need to code specifically).
Plus this should allow to change(test) static content(header, footer links) and dynamic db driven element(entity description, product images) as well. (I know its silly to A/B test dynamic db driven elements, as they are always changeable by CMS tool)
I could figure out 2 probable solutions
1) Change the content of the dom element after page load via JS, But it could lead to minor flickering of the elements as it changes the content after page load(or even during the page load).
2) Change the final html of the response using the after_filter or middleware(not sure of this). I am planning to use nokogiri to parse and alter the html
I wanted to know/confirm if there exists a better way to implement this or any possible flaws in the 2nd approach.