Learn to compare blog posts on even footing using R programming and the googleAnalyticsR package for blog data analysis in this free tutorial.
In my previous role as a marketing data analyst for a blogging company, one of my most important tasks was to track how blog posts performed.
On the surface, it’s a fairly straightforward goal. With Google Analytics, you can quickly get just about any metric you need for your blog posts, for any date range.
But when it comes to comparing blog post performance, things get a bit trickier.
For example, let’s say we want to compare the performance of the blog posts we published on the Dataquest blog in June (using the month of June as our date range).
But wait… two blog posts with more than 1,000 pageviews were published earlier in the month, And the two with fewer than 500 pageviews were published at the end of the month. That’s hardly a fair comparison!
My first solution to this problem was to look up each post individually, so that I could make an even comparison of how each post performed in their first day, first week, first month, etc.
However, that required a lot of manual copy-and-paste work, which was extremely tedious if I wanted to compare more than a few posts, date ranges, or metrics at a time.
But then, I learned R, and realized that there was a much better way.
In this post, we'll walk through how it's done, so you can do my better blog post analysis for yourself!
To complete this tutorial, you’ll need basic knowledge of R syntax and the tidyverse, and access to a Google Analytics account.
Not yet familiar with the basics of R? We can help with that! Our interactive online courses teach you R from scratch, with no prior programming experience required. Sign up and start today!
You’ll also need the
stringr packages installed — which, as a reminder, you can do with the
Finally, you will need a CSV of the blog posts you want to analyze. Here’s what’s in my dataset:
post_url: the page path of the blog post
post_date: the date the post was published (formatted m/d/yy)
category: the blog category the post was published in (optional)
title: the title of the blog post (optional)
Depending on your content management system, there may be a way for you to automate gathering this data — but that’s out of the scope of this tutorial!
For this tutorial, we’ll use a manually-gathered dataset of the past ten Dataquest blog posts.
Data Visualization in R with ggplot2: A Beginner Tutorial. Learn to visualize your data using R and ggplot2 in this beginner-friendly tutorial that walks you through building a chart for data analysis.
Learn how to load a data set and clean it using R programming and tidyverse tools in this free beginner-level data analysis tutorial.
Learn the essential concepts in data science and understand the important packages in R for data science. You will look at some of the widely used data science algorithms such as Linear regression, logistic regression, decision trees, random forest, including time-series analysis. Finally, you will get an idea about the Salary structure, Skills, Jobs, and resume of a data scientist.
Learn the fundamentals of R markdown in this in-depth tutorial, or simply use it as a quick reference guide and cheatsheet for R markdown formatting.In this blog post, we’ll look at how to use R Markdown. By the end, you’ll have the skills you need to produce a document or presentation using R Mardown, from scratch!
A data scientist/analyst in the making needs to format and clean data before being able to perform any kind of exploratory data analysis.