We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22120
    • 21 Posts
    Hey all, apologies, newb to MODx here. Just wondering - Jxxmla does have a module for this - is there one for MODx - or just insert and go? Anyone out there who has used Google Optimizer tags in a MODx site with experience in this? (Any help GREATLY appreciated). A module would certainly make (my) life easier...

    Many thanks from the oldwebdude!
    laugh
      • 33337
      • 3,975 Posts
      I never heard of "Google Optimizer Tags" ... what is it? tongue
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 4310
        • 2,310 Posts
        Me neither wink
        I had a quick look at it but as usual Google made it clear as mud.
          • 22120
          • 21 Posts
          Quote from: zi at Apr 24, 2009, 10:12 AM

          I never heard of "Google Optimizer Tags" ... what is it? tongue

          First - thanks much for trying to help - really appreciate it.

          This is a critical tool for B2C and B2B websites - especially ecommerce sites. I’ll try to explain.

          Google Optimizer is Google’s free tool for a/b and multivariate testing of web pages - translation - basically it allows you to create "experiments" where either: A) different versions of the same web page (you create http://www.example.com/webpage.html and a variation http://www.example.com/webpage.html1 ) are served to visiting traffic, page differences such as call’s to action, button placement, graphic placement, and text copy would be seen if you were to look at the two pages side by side - Google Optimizer then looks at your conversion goal (let’s say our page has a button that says "buy now" which takes you to an order page, with the final sale resulting in a "thank you" page - our conversion page (which tells us a sale has been made) is the "thank you" page) and compares which page converted more traffic - this is called A/B testing; or B) you can have different elements (headline, photo, button) within the same page (http://www.example.com/webpage.html) swap out to see what variations of the various elements within your web page improves your conversion the most - this is called multivariate testing.

          In order to set this up you have to use Google Optimizer and add some javascript tags to your web pages to install your test properly. (the tags change up every time you run an experiment (often) so an ability to add/change these scripts within the CMS would be HUGE).

          Install Instructions for A/B testing from Google:

          Installing and validating JavaScript tags
          If someone else, such as your site’s webmaster, will be adding the JavaScript tags to your pages, select My web team will install... and forward the displayed URL to them. They’ll be able to access all of your account-specific code, but they won’t have access to any other part of your AdWords or Website Optimizer account.

          If you’ll be adding the code to your pages yourself, select that option and click Continue.

          Tagging your original page

          Your original page will need to be tagged with control script as well as tracking script. The control script communicates with Google’s servers to retrieve alternative page information, and ensures that individual users are tracked properly, by showing them the same variation each time, and by not double-counting their visits should they come back to the page at a later time.

          The tracking script sends pageview information to Google, so that visits will be recorded in your reports.

          Add the control script

          Copy and paste the entire control script into the beginning of your original page’s source. It should appear immediately after the opening <head> tag.

          Note: The control script must appear after any DOCTYPE declaration, but before any other content. No other script tags or css tags should appear before the control script.

          Add the tracking script

          Copy and paste the tracking script directly before your page’s closing </body> tag.

          Make sure to use only the tracking script provided in your account, since it contains an account number that’s unique to your experiment. You should also make sure to add the tracking script from the Original page section, as the conversion page tracking script is slightly different.

          Tagging your alternative pages

          Your alternative pages won’t require the control code - they just need the tracking code, directly before each page’s closing </body> tag.

          Tagging your conversion page

          Your conversion page also gets tracking script, which should be pasted directly before the closing </body> tag. Note that the conversion page tracking code is slightly different than the original and alternative page tracking code, so make sure you’re copying and pasting the right one.

          Validating your pages
          Once all of your pages have been updated and uploaded to your server, click Validate pages. Website Optimizer will visit your pages and check for correct installation of your code. If there are problems with the code, you’ll be notified of the error and told on which page the error occurred. Please fix the code and click Validate pages again when you’re ready to validate.

          If everything checks out okay, click OK then Continue to proceed.


          So... for A/B testing, 1. Control and Tracking code needs to be inserted in specific places in HTML, two bits of code a control script (top of page) and a tracking script (bottom of page) would go on http://www.example.com/webpage.html our original page, here is an example of the scripts and where they would be placed on the original page:

          <script>
          function utmx_section(){}function utmx(){}
          (function(){var k=’2033371398’,d=document,l=d.location,c=d.cookie;function f(n){
          if(c){var i=c.indexOf(n+’=’);if(i>-1){var j=c.indexOf(’;’,i);return c.substring(i+n.
          length+1,j<0?c.length:j)}}}var x=f(’__utmx’),xx=f(’__utmxx’),h=l.hash;
          d.write(’<sc’+’ript src="’+
          ’http’+(l.protocol==’https:’?’s://ssl’:’://www’)+’.google-analytics.com’
          +’/siteopt.js?v=1&utmxkey=’+k+’&utmx=’+(x?x:’’)+’&utmxx=’+(xx?xx:’’)+’&utmxtime=’
          +new Date().valueOf()+(h?’&utmxhash=’+escape(h.substr(1)):’’)+
          ’" type="text/javascript" charset="utf-8"></sc’+’ript>’)})();
          </script><script>utmx("url",’A/B’);</script>

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          <title>Buy This Bicycle!</title>
          </head>
          <body>
          <h1>Buy This Bicycle!</h1>
          <img src="images/bike1.jpg" width="400" height="300" alt="Bicycle Image" border="0"/>
          <p>
          Are you new to mountain biking or looking for your first full suspension bike?

          <a href="thankyou.html">BUY NOW! »</a>
          </p>

          <script type="text/javascript">
          if(typeof(_gat)!=’object’)document.write(’<sc’+’ript src="http’+
          (document.location.protocol==’https:’?’s://ssl’:’://www’)+
          ’.google-analytics.com/ga.js"></sc’+’ript>’)</script>
          <script type="text/javascript">
          try {
          var pageTracker=_gat._getTracker("UA-8560821-1");
          pageTracker._trackPageview("/2033371398/test");
          }catch(err){}</script>

          </body>
          </html>


          Then on the variation page at the bottom of that pages HTML would be a different tracking script code that would need to be put in, here is an example of what would go into http://www.example.com/webpage1.html our variation page:

          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          <title>Get Our Bike Now!</title>
          </head>
          <body>
          <h1>Order Online and Get Free Shipping!</h1>
          <img src="images/bike1.jpg" width="400" height="300" alt="Bicycle Image" border="0"/>
          <p>
          Looking for a fantastic mountain bike and looking to save? Buy online now and save the shipping!

          <a href="thankyou.html">Learn more about your options »</a>
          </p>

          <script type="text/javascript">
          if(typeof(_gat)!=’object’)document.write(’<sc’+’ript src="http’+
          (document.location.protocol==’https:’?’s://ssl’:’://www’)+
          ’.google-analytics.com/ga.js"></sc’+’ript>’)</script>
          <script type="text/javascript">
          try {
          var pageTracker=_gat._getTracker("UA-8560821-1");
          pageTracker._trackPageview("/2033371398/test");
          }catch(err){}</script>

          </body>
          </html>

          Finally some tracking code needs to go into the conversion page - translation: this would be the "Thanks for your order!" page on an ecom site for example, or the "Thanks for contacting us" page on a site where we want sales leads. On the conversion page, again we have tracking code to insert, which would go on http://www.example.com/thankyou.html in our example:


          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          <title>Buy This Bicycle!</title>
          </head>
          <body>
          <h1>Thanks for your Order!</h1>
          <img src="images/order_successful.jpg" width="400" height="300" alt="Order Success" border="0"/>
          <p>
          Your receipt will be sent to the email associated with your account.

          </a>
          </p>

          <script type="text/javascript">
          if(typeof(_gat)!=’object’)document.write(’<sc’+’ript src="http’+
          (document.location.protocol==’https:’?’s://ssl’:’://www’)+
          ’.google-analytics.com/ga.js"></sc’+’ript>’)</script>
          <script type="text/javascript">
          try {
          var pageTracker=_gat._getTracker("UA-8560821-1");
          pageTracker._trackPageview("/2033371398/goal");
          }catch(err){}</script>

          </body>
          </html>



          So.... any way to easily incorporate adding/changing scripts like this into MODx without trouble?

          I’ll put some examples of adding scripts for multivariate in another post...
            • 25663 MODX Staff
            • 12,272 Posts
            I’d create two TVS: [*optimizerHead*] and [*optimizerFoot*] as textareas then just stick them in the relevant spot on the template. No module needed.

            If they’re empty, no results are returned, and you can control their content on a page-by-page basis. Add in Manager Manager to hide them from everyone but an "admin super-user" and you’ve got a powerful and simple solution.

            Or am I misunderstanding the request, and missing the need for a module?
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 22120
              • 21 Posts
              OK.. so that last example was how scripts need to be set up for A/B testing (testing two different web pages which are variations of the same page created to see what differences might get more conversions)

              Multivariate testing involves variations within a single web page - changes to the single web page we want to test elements within (rather than two (or more) different entirely separate pages). Here’s what one would do to perform a multivariate test:

              1. Choose the page you would like to test
              Examples of potential test pages could be your homepage or a product detail page.

              2. Choose your page sections
              Your marketing team should decide which sections of your test page you would like Website Optimizer to vary. Some examples of potential test page sections could be headlines, images, testimonials, buttons, and promotional copy.

              3. Review desired page sections with your technical team
              Before you can begin implementing the experiment on your site, your marketing and technical teams will need to agree on which sections to test. Once you have chosen your page sections, proceed to Step 2 so that you or your webmaster can copy the Website Optimizer JavaScript tags and add them to your test page’s source code.

              4. Identify your conversion / success / goal page
              This is an existing page on your website that users reach after they’ve completed a successful conversion. For example, this might be the page displayed after a user completes a purchase, signs up for a newsletter, or fills out a contact form.

              First we have to again put a control script and a tracking script into our single page, again, the control script goes at the top, the tracking script goes in at the bottom before the close of the </body> tag, again here would be the example of our http://www.example.com/webpage.html we want to perform multivariate testing for:

              <html>
              <head>

              <script>
              function utmx_section(){}function utmx(){}
              (function(){var k=’3211406635’,d=document,l=d.location,c=d.cookie;function f(n){
              if(c){var i=c.indexOf(n+’=’);if(i>-1){var j=c.indexOf(’;’,i);return c.substring(i+n.
              length+1,j<0?c.length:j)}}}var x=f(’__utmx’),xx=f(’__utmxx’),h=l.hash;
              d.write(’<sc’+’ript src="’+
              ’http’+(l.protocol==’https:’?’s://ssl’:’://www’)+’.google-analytics.com’
              +’/siteopt.js?v=1&utmxkey=’+k+’&utmx=’+(x?x:’’)+’&utmxx=’+(xx?xx:’’)+’&utmxtime=’
              +new Date().valueOf()+(h?’&utmxhash=’+escape(h.substr(1)):’’)+
              ’" type="text/javascript" charset="utf-8"></sc’+’ript>’)})();
              </script>

              <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
              <title>Buy This Bicycle!</title>
              </head>
              <body>


              <h1>Buy This Bicycle!</h1>
              <img src="images/bike1.jpg" width="400" height="300" alt="Bicycle Image" border="0"/>
              <p>
              Are you new to mountain biking or looking for your first full suspension bike?

              <a href="thankyou.html">Learn more about your options »</a>
              </p>

              <script type="text/javascript">
              if(typeof(_gat)!=’object’)document.write(’<sc’+’ript src="http’+
              (document.location.protocol==’https:’?’s://ssl’:’://www’)+
              ’.google-analytics.com/ga.js"></sc’+’ript>’)</script>
              <script type="text/javascript">
              try {
              var pageTracker=_gat._getTracker("UA-8560821-1");
              pageTracker._trackPageview("/3211406635/test");
              }catch(err){}</script>

              </body>
              </html>


              Find the sections (e.g. headline, a graphic, a button, a section of copy, news, etc.) in your single web page we are experimenting with - e.g. http://www.example.com/webpage.html - that you’d like to vary as part of your experiment. Surround the source code of each section of your original content with the following tags and give each section a unique name, like this:

              Paste the following immediately before the content you would like to vary:
              <script>utmx_section("Insert your section name here")</script>

              Paste the following immediately after the content you would like to vary:
              </noscript>

              Don’t worry about the unbalanced </noscript> tag, [WEBSITE_OPTIMIZER] is designed to work with this when it serves variations of your content.

              For example, if you’d like to test a headline, your section might look like this:

              <script>utmx_section("Headline")</script>
              <h1>Buy This Product!</h1>
              </noscript>

              Here’s how our full http://www.example.com/webpage.html page would look with a few multivariate noscript tags added to sections we want to test:

              <html>
              <head>

              <script>
              function utmx_section(){}function utmx(){}
              (function(){var k=’3211406635’,d=document,l=d.location,c=d.cookie;function f(n){
              if(c){var i=c.indexOf(n+’=’);if(i>-1){var j=c.indexOf(’;’,i);return c.substring(i+n.
              length+1,j<0?c.length:j)}}}var x=f(’__utmx’),xx=f(’__utmxx’),h=l.hash;
              d.write(’<sc’+’ript src="’+
              ’http’+(l.protocol==’https:’?’s://ssl’:’://www’)+’.google-analytics.com’
              +’/siteopt.js?v=1&utmxkey=’+k+’&utmx=’+(x?x:’’)+’&utmxx=’+(xx?xx:’’)+’&utmxtime=’
              +new Date().valueOf()+(h?’&utmxhash=’+escape(h.substr(1)):’’)+
              ’" type="text/javascript" charset="utf-8"></sc’+’ript>’)})();
              </script>

              <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
              <title>Buy This Bicycle!</title>
              </head>
              <body>

              <script>utmx_section("Headline")</script>
              <h1>Buy This Bicycle!</h1>
              </noscript>
              <script>utmx_section("Image")</script>
              <img src="images/bike1.jpg" width="400" height="300" alt="Bicycle Image" border="0"/>
              </noscript>
              <p>
              Are you new to mountain biking or looking for your first full suspension bike?

              <script>utmx_section("Call to action")</script> <a href="thankyou.html">Learn more about your options »</a></noscript>
              </p>

              <script type="text/javascript">
              if(typeof(_gat)!=’object’)document.write(’<sc’+’ript src="http’+
              (document.location.protocol==’https:’?’s://ssl’:’://www’)+
              ’.google-analytics.com/ga.js"></sc’+’ript>’)</script>
              <script type="text/javascript">
              try {
              var pageTracker=_gat._getTracker("UA-8560821-1");
              pageTracker._trackPageview("/3211406635/test");
              }catch(err){}</script>

              </body>
              </html>


              NOW.. .here’s the thing doing this for every single element you may want to test/move around is a pain in the (you know), so instead of exactly following this method, I credit James Paden for the following info/CSS technique for implementing multivariate tags for GWO (Google Web Optimizer).

              Ignore the strange noscript script, that’s just the way GWO (Google Website Optimizer) works. Once you’ve implemented the script, you then upload alternative versions of your HTML to the GWO website. GWO will insert the alternative versions of the HTML randomly to your visitors to test which versions perform better. You can test page layout, button color/sizes, ads, textual content, navigation structure or anything else you can imagine.

              The problem occurs when you want to test dynamic pages or the same section of HTML across multiple pages. For example, I want to test a different product page layout across my site (because no single product gets enough traffic to reliably traffic). I cannot insert HTML into the GWO script because the HTML will be different on every page.

              The secret (which many of you may have already figured out, but it took me a while so hopefully this post will help some of you) is to insert CSS or Javascript ONLY into your GWO script. View GWO as a rotating CSS/JS file, not as actual HTML. This may involve using CSS to hide or change various aspects of your page and I’ve even used GWO to alter the HTML structure via Javascript on pages I did not have full control over. Before, your code might have been:

              <script>utmx_section("Your First Test")</script>
              <h1>Large Product Title</h1>
              <img src=’bluebutton.gif’>
              </noscript>

              Now you can do the below and apply the same test to every product:

              <script>utmx_section("Your First Test")</script>
              <style type=’text/css’>
              .producttitle {
              font-size: 24px;
              }
              </style>
              <script type=’text/javascript’>
              document.getElementById(’addtocartbutton’).src = ’bluebutton.gif’;
              </script>
              </noscript>

              This is a very simple example, but the power of this concept is that you can now test large sections of your entire site. You can use CSS to move switch the positions of content sections or hide all the product prices for your category pages (early testing shows this actually improves the conversion rates on one of my sites…).

              You still need to put a conversion script on the http://www.example.com/thankyou.html page like we did in the A/B testing example as a final step (see the example code in my first reply post please) which goes at the bottom of the page before the </body> close tag.


              OK... so now it should be (hopefully) clear why it would be important within MODx to be able to handle the multivariate CSS tagging - is there a way within MODx or a MODx module to make this work easier?

              I’ve (obviously) never tried either an A/B or multivariate GWO test through MODx --- but definately I (and my clients) will want (and should want) to do these tests to optimize conversions ($).

              Thanks so very much for any/all help and replies folks!!

                • 22120
                • 21 Posts
                Quote from: rthrash at Apr 27, 2009, 09:20 AM

                I’d create two TVS: [*optimizerHead*] and [*optimizerFoot*] as textareas then just stick them in the relevant spot on the template. No module needed.

                If they’re empty, no results are returned, and you can control their content on a page-by-page basis. Add in Manager Manager to hide them from everyone but an "admin super-user" and you’ve got a powerful and simple solution.

                Or am I misunderstanding the request, and missing the need for a module?

                That solves A/B testing I think (elegant solution - thanks very much) but for Multivariate Testing (please see my post on how this can be implemented in CSS instead of through noscript tagging of sections) - I’m wondering if a module would be useful/needed in this instance?

                Again a HUGE thank you for the help!