With Google Website Optimizer's multivariate testing, can I vary multiple css classes on a single di
        Posted  
        
            by brahn
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by brahn
        
        
        
        Published on 2010-06-07T21:11:05Z
        Indexed on 
            2010/06/07
            21:12 UTC
        
        
        Read the original article
        Hit count: 371
        
google-website-optimizer
I would like to use Google Website Optimizer (GWO)'s multivariate tests to test some different versions of a web page. I can change from version to version just by varying some class tags on a div, i.e. the different versions are of this form:
<div id="testing" class="foo1 bar1">content</div>
<div id="testing" class="foo1 bar2">content</div>
<div id="testing" class="foo2 bar1">content</div>
<div id="testing" class="foo2 bar2">content</div>
In the ideal, I would be able to use GWO section code in place of each class, and google would just swap in the appropriate tags (foo1 or foo2, bar1 or bar2).  However, naively doing this results in horribly malformed code because I would be trying to put <script> tags inside the div's class attribute:
<div id="testing" class="
  <script>utmx_section("foo-class")</script>foo1</noscript>
  <script>utmx_section("bar-class")</script>bar1</noscript>
">
  content
</div>
And indeed, the browser chokes all over it.
My current best approach is just to use a different div for each variable in the test, as follows:
<script>utmx_section("foo-class-div")</script>
  <div class="foo1">
</noscript>
  <script>utmx_section("bar-class-div")</script>
    <div class="bar1">
  </noscript>
    content
  </div>
</div>
So testing multiple variables requires layer of div-nesting per variable, and it all seems rather awkward.
Is there a better approach that I could use in which I just vary the classes on a single div?
© Stack Overflow or respective owner