{"id":76008,"date":"2017-09-13T11:30:53","date_gmt":"2017-09-13T10:30:53","guid":{"rendered":"https:\/\/createandcode.com\/?p=76008"},"modified":"2017-09-13T11:36:01","modified_gmt":"2017-09-13T10:36:01","slug":"google-analytics-content-experiments-wordpress","status":"publish","type":"post","link":"https:\/\/createandcode.com\/google-analytics-content-experiments-wordpress\/","title":{"rendered":"How to Run Google Analytics Content Experiments on WordPress"},"content":{"rendered":"<p>Do you know if your website is doing as well as it should be? Do you know if you chose the best text for your CTA button? Or if your headline isn\u2019t performing as well as possible?<\/p>\n<p>Unless you\u2019re regularly testing different versions of your site &#8211; the simple truth is that you can\u2019t know <em>because you don\u2019t have the data to know<\/em>. To get that data &#8211; or at least to come closer to the right answer &#8211; you can run A\/B tests to compare different versions of your site and see which performs better.<\/p>\n<p>Many WordPress users can\u2019t figure out how to run A\/B tests on WordPress, though. Or, they can\u2019t afford the premium tools that make A\/B tests easy.<\/p>\n<p>To help solve the problem, I\u2019m going to show you how to run Google Analytics Content Experiments on WordPress for an easy, and free, way to split test your WordPress site.<br \/>\n<!--more--><\/p>\n<h2>What Are Google Analytics Content Experiments?<\/h2>\n<p>While I said A\/B testing above, Google Analytics Content Experiments is technically an <strong>A\/B\/<\/strong><strong><em>N<\/em><\/strong> testing tool. That means you can test <strong>up to 10<\/strong> different versions of a single page to see which performs better.<\/p>\n<p>Unlike some testing tools where the page URL stays the same, but an element or two is dynamically switched, Content Experiments works by serving <strong>completely different pages<\/strong> to different samples of users. <em>You can, of course, still test specific variables by serving up an almost perfect clone of a page, just with an element or two changed.<\/em><\/p>\n<p>What\u2019s neat about Content Experiments is that you create them through the Google Analytics interface, which means you can view data for them in the full context of all of your other Google Analytics data.<\/p>\n<h3>How Do You Run Content Experiments?<\/h3>\n<p>Running Content Experiments requires two things:<\/p>\n<ul>\n<li>Setting up the Content Experiment in the Google Analytics interface<\/li>\n<li>Adding the Content Experiments code to your WordPress site so that it only affects the right page<\/li>\n<\/ul>\n<p>Here\u2019s how to do it&#8230;<\/p>\n<h2>How to Run Google Analytics Content Experiments on WordPress<\/h2>\n<p>In this guide, I\u2019ll show you how to manually set up Google Analytics Content Experiments to work with WordPress.<\/p>\n<p><em>I\u2019m going to assume you already have the basic Google Analytics tracking code installed in WordPress. But if you don\u2019t use Google Analytics already, you\u2019ll need to set that up before beginning.<\/em><\/p>\n<h3>Step 1: Create a Page Variant to Test<\/h3>\n<p>The first thing that you need to do is create a variant of the page that you want to test. For example, if you want to test the CTA button on your WordPress site\u2019s homepage, create a duplicate of your homepage and make the change to your button.<\/p>\n<p>For my example,<\/p>\n<ul>\n<li>My original homepage is: <em>colinstest.website<\/em><\/li>\n<li>My variant is: <em>colinstest.website\/test2<\/em><\/li>\n<\/ul>\n<h3>Step 2: Create a Content Experiment in Google Analytics<\/h3>\n<p>To create a new Content Experiment, go to your Google Analytics account and navigate to <strong>Behavior \u2192 Experiments.<\/strong><\/p>\n<p>Then, click <strong>Create experiment<\/strong>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76017\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-1.png\" alt=\"google analytics content experiments wordpress\" width=\"1038\" height=\"615\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-1.png 1038w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-1-345x204.png 345w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-1-1024x607.png 1024w\" sizes=\"auto, (max-width: 1038px) 100vw, 1038px\" \/><\/p>\n<p>On the next screen, you\u2019ll need to fill in some basic information:<\/p>\n<ul>\n<li><strong><strong>Name for this experiment <\/strong>&#8211;<\/strong> this is purely internal. Make it something that\u2019s easy to remember<\/li>\n<li><strong>Objective for this experiment<\/strong> &#8211; select the metric that you want to compare. If you\u2019re using Goals, you should set this as a relevant Goal. Otherwise, you can choose generic metrics like bounce rate.<\/li>\n<li><strong>Percentage of traffic to experiment <\/strong>&#8211; what percent of traffic do you want to redirect to this experiment. If you choose 50%, 50% of your traffic will see your homepage like normal, while the other 50% will be split between your various test pages (<em>including your homepage<\/em>)<\/li>\n<li><strong>Advanced Options <\/strong>&#8211; these let you set traffic distributions, experiment durations, and confidence thresholds. Feel free to leave them as the default<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76233\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-2-4.png\" alt=\"\" width=\"849\" height=\"550\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-2-4.png 849w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-2-4-345x223.png 345w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/p>\n<p>Click <strong>Next Step<\/strong> when you\u2019re done.<\/p>\n<p>On the next screen, you need to enter the original page for your test, as well as the variant page(s) you want to test against.<\/p>\n<p>Remember &#8211; you can add up to 10 variants:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76234\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-3-3.png\" alt=\"\" width=\"1065\" height=\"586\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-3-3.png 1065w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-3-3-345x190.png 345w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-3-3-1024x563.png 1024w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-3-3-301x166.png 301w\" sizes=\"auto, (max-width: 1065px) 100vw, 1065px\" \/><\/p>\n<p>Click <strong>Next Step <\/strong>once you\u2019ve added all of your variants.<\/p>\n<p>On the next screen, choose <strong>Manually insert the code<\/strong> to get your experiment code:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76235\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-4-3.png\" alt=\"\" width=\"994\" height=\"589\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-4-3.png 994w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-4-3-345x204.png 345w\" sizes=\"auto, (max-width: 994px) 100vw, 994px\" \/><\/p>\n<p>And then you should see your code snippet:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76236\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-5-3.png\" alt=\"\" width=\"760\" height=\"457\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-5-3.png 760w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-5-3-345x207.png 345w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/p>\n<p><strong>Leave this page open because you\u2019ll need to come back to it<\/strong>.<\/p>\n<p>But for now, you need to hop over to your WordPress site and add the Content Experiments code.<\/p>\n<h3>Step 3: Add Content Experiments Code to WordPress<\/h3>\n<p>To easily add the Content Experiments code to WordPress, I recommend using the free <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\">Code Snippets plugin<\/a> because it makes it easy to keep track of the code for multiple Content Experiments.<\/p>\n<p>Once you\u2019ve installed and activated the Code Snippets plugin, go to <strong>Snippets \u2192 Add New<\/strong>.<\/p>\n<p>Unfortunately, <strong>you can\u2019t just paste in the Content Experiments code because then WordPress would add the code to every single page, which you don\u2019t want<\/strong>.<\/p>\n<p>Instead, you need to properly register the function <strong>and <\/strong>wrap the code in a PHP If statement to ensure that it only fires on the original page of your Content Experiment.<\/p>\n<p>For my example, here\u2019s how that would look (<em>don\u2019t worry &#8211; I\u2019ll give you templates for this code<\/em>):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76237\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-6-3.png\" alt=\"\" width=\"1247\" height=\"815\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-6-3.png 1247w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-6-3-345x225.png 345w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-6-3-1024x669.png 1024w\" sizes=\"auto, (max-width: 1247px) 100vw, 1247px\" \/><\/p>\n<p>In this script, <code>is_front_page()<\/code> tells WordPress to <strong>only<\/strong> run the Content Experiments code on the front-page.<\/p>\n<p>If you\u2019re running Content Experiments on a subpage, you\u2019ll want to use <code>is_single(POST_ID)<\/code> instead.<\/p>\n<p>Here are some templates for both:<\/p>\n<p>To run a content experiment on the front-page, use this code:<\/p>\n<pre class=\"\">\/**\r\n* Add GA Content Experiments Scripts Here\r\n*\/\r\nfunction content_experiments_head_script() {\r\nif(is_front_page()) { ?>\r\n<!-- Google Analytics Content Experiment code -->\r\nREPLACE WITH YOUR OWN CODE\r\n<!-- End of Google Analytics Content Experiment code -->;\r\n<?php }\r\n}\r\nadd_action( 'wp_head', 'content_experiments_head_script' );<\/pre>\n<p>To run a Content Experiment on a subpage, use this code and replace the example post ID with the actual post ID of your original page.<\/p>\n<pre>\/**\r\n* Add GA Content Experiments Scripts Here\r\n*\/\r\nfunction content_experiments_head_script() {\r\nif(is_single(73790)) { ?><\/pre>\n<pre><!-- Google Analytics Content Experiment code -->\r\nREPLACE WITH YOUR OWN CODE\r\n<!-- End of Google Analytics Content Experiment code -->\r\n<?php }\r\n}\r\nadd_action( 'wp_head', 'content_experiments_head_script' );<\/pre>\n<p>You can find the Post ID by looking at the URL while editing any post, page, or custom post type:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76238\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-7-3.png\" alt=\"\" width=\"871\" height=\"325\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-7-3.png 871w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-7-3-345x129.png 345w\" sizes=\"auto, (max-width: 871px) 100vw, 871px\" \/><\/p>\n<p>Once you add your code, scroll down and choose <strong>Only run on site front-end <\/strong>and then <strong>Save Changes and Activate<\/strong>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76239\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-8-3.png\" alt=\"\" width=\"842\" height=\"547\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-8-3.png 842w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-8-3-345x224.png 345w\" sizes=\"auto, (max-width: 842px) 100vw, 842px\" \/><\/p>\n<h3>Step 4: Verify Content Experiments Code and Start Experiment<\/h3>\n<p>Now, head back to Google Analytics and click <strong>Save Changes<\/strong>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76240\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-9-3.png\" alt=\"\" width=\"825\" height=\"393\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-9-3.png 825w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-9-3-345x164.png 345w\" sizes=\"auto, (max-width: 825px) 100vw, 825px\" \/><\/p>\n<p>Google will verify that your code is properly installed. Then, just click <strong>Start Experiment to <\/strong>begin the experiment:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76241\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-10-3.png\" alt=\"\" width=\"817\" height=\"393\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-10-3.png 817w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-10-3-345x166.png 345w\" sizes=\"auto, (max-width: 817px) 100vw, 817px\" \/><\/p>\n<p>And that\u2019s it! Your test is live. You can monitor your Experiment from your Google Analytics account.<\/p>\n<p>Once Google finds the version that performs best for your specific objective, it will let you know:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-76242\" src=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-11-3.png\" alt=\"\" width=\"1206\" height=\"441\" srcset=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-11-3.png 1206w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-11-3-345x126.png 345w, https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-analytics-content-experiments-wordpress-11-3-1024x374.png 1024w\" sizes=\"auto, (max-width: 1206px) 100vw, 1206px\" \/><\/p>\n<p>Now all you need to do is wait.<\/p>\n<h2>Best Practices for Running Content Experiments<\/h2>\n<p>While it\u2019s fairly easy to set up Google Analytics Content Experiments on WordPress, you should make sure to follow a few best practices to ensure your site still operates smoothly:<\/p>\n<ul>\n<li>Don\u2019t use Content Experiments as <a href=\"https:\/\/support.google.com\/analytics\/answer\/2576845?hl=en&amp;ref_topic=1745207\" target=\"_blank\" rel=\"noopener\">a form of cloaking<\/a>. Google recommends that \u201cyour variation pages should maintain the spirit of the content on your original pages\u201d.<\/li>\n<li>Update the code of your original page as soon as you\u2019ve found a winner<\/li>\n<li>Use a rel=\u201dcanonical\u201d tag to ensure the experiment <a href=\"https:\/\/support.google.com\/analytics\/answer\/2613318?hl=en&amp;ref_topic=1745207\" target=\"_blank\" rel=\"noopener\">doesn\u2019t affect your site\u2019s SEO<\/a>. Most <a href=\"https:\/\/createandcode.com\/best-wordpress-seo-plugins\/\">WordPress SEO plugins<\/a> can help you set these up.<\/li>\n<li>301 redirect variant pages to your original page after you finish running the experiment.<\/li>\n<\/ul>\n<h2>Wrapping Things Up<\/h2>\n<p>While there are some Google Content Experiments plugins for WordPress, most are either:<\/p>\n<ul>\n<li>Out of date<\/li>\n<li>Not very popular<\/li>\n<\/ul>\n<p>Some, like <a href=\"https:\/\/wordpress.org\/plugins\/simple-content-experiments\/\" target=\"_blank\" rel=\"noopener\">Simple Content Experiments<\/a>, are intriguing because they let you run Content Experiments without creating multiple pages.<\/p>\n<p>But because of the low usage rate, I feel more comfortable recommending the manual method because I\u2019m 100% certain it will work for all WordPress users.<\/p>\n<p>Remember - all you need to do is:<\/p>\n<ul>\n<li>Create your variant page(s)<\/li>\n<li>Set up a Content Experiment in Google Analytics<\/li>\n<li>Add the Experiment code to WordPress, with an IF statement to only display it on the proper page<\/li>\n<li>Start your Experiment<\/li>\n<\/ul>\n<p>As you become more accustomed to how to run Experiments, you may even want to check out <a href=\"https:\/\/www.google.com\/analytics\/optimize\/\" target=\"_blank\" rel=\"noopener\">Google Optimize<\/a> for more power.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you know if your website is doing as well as it should be? Do you know if you chose the best text for your CTA button? Or if your headline isn\u2019t performing as well as possible? Unless you\u2019re regularly testing different versions of your site &#8211; the simple truth is that you can\u2019t know [&hellip;]<\/p>\n","protected":false},"author":62,"featured_media":76260,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[168],"tags":[238,249],"class_list":["post-76008","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business","tag-analytics","tag-split-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Run Google Analytics Content Experiments on WordPress - Create and Code<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/createandcode.com\/google-analytics-content-experiments-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Run Google Analytics Content Experiments on WordPress - Create and Code\" \/>\n<meta property=\"og:description\" content=\"Do you know if your website is doing as well as it should be? Do you know if you chose the best text for your CTA button? Or if your headline isn\u2019t performing as well as possible? Unless you\u2019re regularly testing different versions of your site &#8211; the simple truth is that you can\u2019t know [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/createandcode.com\/google-analytics-content-experiments-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Create and Code\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/createandcode\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-13T10:30:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-09-13T10:36:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-content-experiments-wordpress.png\" \/>\n\t<meta property=\"og:image:width\" content=\"931\" \/>\n\t<meta property=\"og:image:height\" content=\"514\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ColinNewcomer\" \/>\n<meta name=\"twitter:site\" content=\"@gocreateandcode\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","jetpack_featured_media_url":"https:\/\/createandcode.com\/wp-content\/uploads\/2017\/09\/google-content-experiments-wordpress.png","_links":{"self":[{"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/posts\/76008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/comments?post=76008"}],"version-history":[{"count":17,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/posts\/76008\/revisions"}],"predecessor-version":[{"id":76281,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/posts\/76008\/revisions\/76281"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/media\/76260"}],"wp:attachment":[{"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/media?parent=76008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/categories?post=76008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/createandcode.com\/wp-json\/wp\/v2\/tags?post=76008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}