<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/optimising-your-blog-with-r-and-google-optimize/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://flovv.github.io/Website_Optimization/"> Florian Teschner</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>When writing a blog, sooner or later, one measures and consequently tries to improve some kind of success metric.<br>
In my case; I have been tracking user behavior (visitors, bounce rate, pageviews, …) for slightly over a year with Google Analytics. While some posts have been more “successful” than others, it is not my goal to change the topics and headlining in order to get more clicks. Instead, one metric that I care about is that visitors find value in the stuff they read and subsequently read more of the past blog posts. In order to see if I can tweak this metric I ran a small AB-test over the last two months.</p>
<p>50% of the blog visitors saw a new start page where the excerpt after the blog post headline was hidden.<br>
The following images shows the difference between test-setting and baseline-setting.</p>
<p><img alt="plot of experiment setting" src="https://i1.wp.com/flovv.github.io/figures/post20/ContentExperiment.jpg?w=456" data-recalc-dims="1"></p>
<p>What do you expect? Did the test-setting outperform the baseline setting in terms of pageviews?<br>
As I use a very common jekyll blog theme, my assumption was that the theme authors know more about usability than me and would have optimized for reader-“engagement”.<br>
So let’s have a look at the data. The <a target="_blank" rel="nofollow" href="http://code.markedmondson.me/googleAnalyticsR/">googleAnalyticsR-package</a> allows to conveniently load the data from GA into R.</p>
<figure>
<pre><code data-lang="r"><span>library</span><span>(</span><span>googleAnalyticsR</span><span>)</span><span>
</span><span>googleAnalyticsR</span><span>::</span><span>ga_auth</span><span>()</span><span>
</span><span>account_list</span><span> </span><span>&lt;-</span><span> </span><span>google_analytics_account_list</span><span>()</span><span>
</span><span>ga_id</span><span> </span><span>&lt;-</span><span> </span><span>119848123</span><span>
</span><span>dff</span><span> </span><span>&lt;-</span><span> </span><span>google_analytics_4</span><span>(</span><span>ga_id</span><span>,</span><span> </span><span>date_range</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;2017-02-19&quot;</span><span>,</span><span>&quot;2017-04-14&quot;</span><span>),</span><span> </span><span>metrics</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;users&quot;</span><span>,</span><span>&quot;sessions&quot;</span><span>,</span><span>&quot;bounceRate&quot;</span><span>,</span><span> </span><span>&quot;avgSessionDuration&quot;</span><span>,</span><span> </span><span>&quot;pageviews&quot;</span><span>,</span><span> </span><span>&quot;pageviewsPerSession&quot;</span><span>),</span><span> </span><span>dimensions</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;date&quot;</span><span>,</span><span>&quot;experimentVariant&quot;</span><span>),</span><span>
</span><span>anti_sample</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)</span></code></pre>
</figure>
<p>With the downloaded data, I use the fresh <a target="_blank" rel="nofollow" href="http://flovv.github.io/Weighted_Mean_Standard_Errors/">weighted.summarySE</a> function to compare the two key KPIs; bounce-rate and pageviews per session in both settings.</p>
<figure>
<pre><code data-lang="r"><span>dff</span><span>$</span><span>Test</span><span> </span><span>&lt;-</span><span> </span><span>ifelse</span><span>(</span><span>dff</span><span>$</span><span>experimentVariant</span><span> </span><span>==</span><span> </span><span>0</span><span>,</span><span> </span><span>&quot;Baseline&quot;</span><span>,</span><span> </span><span>&quot;Experiment \n Setting&quot;</span><span>)</span><span>
</span><span>mm</span><span> </span><span>&lt;-</span><span> </span><span>melt</span><span>(</span><span>dff</span><span>[,</span><span> </span><span>c</span><span>(</span><span>&quot;Test&quot;</span><span>,</span><span> </span><span>&quot;sessions&quot;</span><span>,</span><span> </span><span>&quot;bounceRate&quot;</span><span>,</span><span> </span><span>&quot;pageviewsPerSession&quot;</span><span>)],</span><span> </span><span>id.vars</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;Test&quot;</span><span>,</span><span> </span><span>&quot;sessions&quot;</span><span>))</span><span>
</span><span>dfc</span><span> </span><span>&lt;-</span><span> </span><span>weighted.summarySE</span><span>(</span><span>mm</span><span>,</span><span> </span><span>measurevar</span><span>=</span><span>&quot;value&quot;</span><span>,</span><span> </span><span>groupvars</span><span>=</span><span>c</span><span>(</span><span>&quot;Test&quot;</span><span>,</span><span> </span><span>&quot;variable&quot;</span><span>),</span><span> </span><span>weights</span><span> </span><span>=</span><span> </span><span>&quot;sessions&quot;</span><span>,</span><span>na.rm</span><span>=</span><span>T</span><span>)</span><span>
</span><span>p</span><span>1</span><span>&lt;-</span><span>ggplot</span><span>(</span><span>dfc</span><span>,</span><span> </span><span>aes</span><span>(</span><span>Test</span><span>,</span><span> </span><span>value</span><span>))</span><span> </span><span>+</span><span> </span><span>geom_point</span><span>()</span><span> </span><span>+</span><span> </span><span>geom_errorbar</span><span>(</span><span>aes</span><span>(</span><span>ymin</span><span>=</span><span>value</span><span>-</span><span>se</span><span>,</span><span> </span><span>ymax</span><span>=</span><span>value</span><span>+</span><span>se</span><span>),</span><span> </span><span>width</span><span>=</span><span>.1</span><span>)</span><span>
</span><span>p</span><span>1</span><span> </span><span>+</span><span> </span><span>theme_economist</span><span>(</span><span>base_size</span><span> </span><span>=</span><span> </span><span>16</span><span>)</span><span> </span><span>+</span><span> </span><span>xlab</span><span>(</span><span>&quot;&quot;</span><span>)</span><span> </span><span>+</span><span> </span><span>ylab</span><span>(</span><span>&quot;&quot;</span><span>)</span><span> </span><span>+</span><span> </span><span>facet_wrap</span><span>(</span><span>~</span><span>variable</span><span>,</span><span> </span><span>scales</span><span>=</span><span>&quot;free_y&quot;</span><span>,</span><span> </span><span>ncol</span><span> </span><span>=</span><span> </span><span>1</span><span>)</span></code></pre>
</figure>
<p><img alt="plot of chunk unnamed-chunk-11" src="https://i0.wp.com/flovv.github.io/figures/post20/unnamed-chunk-11-1.png?w=456" data-recalc-dims="1"></p>
<p>Wow, what a difference; both measures are improved by ~25%. I am seriously surprised by the large effect of such a small change. While I have been testing the effect of interface changes on user behavior before (among others as part of my dissertation), these effects are still a surprise.</p>
<p>As of yesterday, I stopped the experiment and permanently changed the blog-layout to be slightly more compact but 25% more successful ;).</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://flovv.github.io/Website_Optimization/"> Florian Teschner</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/1gYebDR2Xwk"></a></div>