on March 15, 2018 (last modified on August 23, 2021) • 11 minute read
If you use Google Analytics to measure your content marketing, you have probably noticed that it does not offer two valuable dimensions for analyzing your data.
First, Google Analytics does not let you review the top-performing authors on your blog.
Even if you use a system like HubSpot, you can only measure sessions, conversions and conversion rate. You do not get any other quality metrics like bounce rate or time on page.
Second, Google Analytics does not show the publish dates of each page. So, if you want to see how your most recent blog posts are performing, you need to search for each one by title or URL. You can’t even do it in a custom report!
So, I wanted to find an automatic way to track the author and publish date of every post, so that you can use those dimensions alongside all metrics within Google Analytics- pageviews, time on page, bounce rate etc.
As long as you have Google Tag Manager set up on your domain, you can actually do this pretty easily. I will show you how to create custom variables in Google Tag Manager that can be loaded up into Google Analytics as custom dimensions.
At the end, you will be able to run any report in Google Analytics (or Databox) with author and publish date dimensions.
Image Credit- Branded3
Google Tag Manager (GTM) is a single code that allows you to quickly update all the third party HTML tags that you add to your website. Since it is an online interface (tagmanager.google.com), any team member can use it to update HTML codes, instead of waiting on a developer. If you plan to use other technologies within your site, like Hotjar or Drift, you should definitely set it up to make it easier to manage tags.
As an example, let’s say that you want to add Drift, a chatbot for marketers and salespeople, to your site. Without GTM, you would need to manually update each Google Analytics tracking code in order to track data on user interaction.
This tutorial is going to cover both WordPress and HubSpot users, so here are two quick guides to installing GTM, if you have not already.
Use the GTM for WordPress plugin to add GTM to your WordPress site and manage it from the WordPress interface.
If you use HubSpot, check out their guide to adding GTM to HubSpot.
We need to do five things in order to get the name of the author into Google Analytics.
Yes, those are slightly out of order compared to the diagram above, but that is the easiest way to create the path from beginning to end.
To optimize your website’s content for conversion, you probably use Google Analytics to learn how many people are interacting with your site, which pages brought them to the site in the first place, which pages they engage with the most, and more.
You may have to navigate multiple areas and reports within Google Analytics to get the data you want though. Now you can quickly assess your content performance in a single dashboard that monitors fundamental metrics, such as:
Now you can benefit from the experience of our Google Analytics experts, who have put together a plug-and-play Databox template showing the most important metrics for measuring your website content marketing performance. It’s simple to implement and start using as a standalone dashboard or in marketing reports, and best of all, it’s free!
You can easily set it up in just a few clicks – no coding required.
To set up the dashboard, follow these 3 simple steps:
Step 1: Get the template
Step 2: Connect your Google Analytics account with Databox.
Step 3: Watch your dashboard populate in seconds.
This is the endpoint where you can eventually access the data in Google Analytics.
If you use HubSpot, skip ahead to the next section. If you use WordPress, check out the “Settings” page for your GTM for WordPress plugin. Make sure the “Post Author name” checkbox is checked.That means that the author name will be available as part of the dataLayer object. You can make sure it is working by opening up the inspector in your browser, clicking into the “Console” tab, and typing “dataLayer”. You should see an array of objects with data like this:In this case, the author data has a label of “pagePostAuthor”. Now, you need to sync that information with Google Tag Manager. Log into Google Tag Manager, and click the “Variables” section on the left.Create a new “User-Defined Variable” at the bottom of the page, and make it a “Data-Layer Variable”. Give it a name of Author”. The data layer variable name must be the exact same as the label above, so in this case, that means that it is “pagePostAuthor”.Skip down to “Connecting a User-Defined Variable to a Custom Dimension” to finish the process.
In HubSpot, the author data is usually stored as a meta tag, so there is no need to add a plugin or integration. Click into any blog on your domain, and open up the inspector. Look within the “head” section of the HTML, and you should find a meta tag with the name of “author”.This is the data you will import into Google Tag Manager.
Here is the last part. We need to connect the data in this user-defined variable to the correct custom dimension in Google Analytics. Click on the “Tags” menu on the left, and find the tag with your Google Analytics tracking code that fires on every page. It should have a “Type” of “Universal Analytics”.
From there, find the “More Settings” dropdown, then the “Custom Dimensions” dropdown under that.Add an Index of 1 to match the index you previously set up in Google Analytics. Then, select the block on the far right, and select the User-Defined Variable you set up previously.
To begin adding the author data to Google Analytics, click “Submit” in the top right.After that, Google Analytics will track the author on every page view, and allow you to track your top authors on an ongoing basis.
We must create a number to represent each date so that we can easily categorize our posts by publish date. In other words, we don’t want to use words like “March 15, 2018”, but instead, we should use “20180315”. This will make it easier to sort the posts using regular expressions.
As you can see from the dataLayer object below, each of those numerical dates is available as a separate property. So, just like above, we are going to import each one into Tag Manager, and combine them into one custom dimension.
You will want to create a new custom dimension called “PublishDate” in the second dimension slot (this will happen by default).
Before we create a date by combining the three properties, we need to create a user-defined variable for each one to get them into Tag Manager. Each one is a Data Layer Variable.
PublishYear stores the year.
PublishMonth stores the month.
PublishDay stores the day.
From there, find the “More Settings” dropdown, then the “Custom Dimensions” dropdown under that.
As you can see above, we add all three variables into one string using double brackets. There should not be any spaces between the variables. This will create one complete date.
Since the title tag is a universal HTML tag, we can pull it into the Google Analytics in the same way across all CMS systems. The steps are very similar to the ones above.
You can find your page title by opening the inspector on any blog post, then looking for the head section within the HTML. You can find the title within the head section.
Create a new custom dimension with the same process as you used above. Except this time, call the dimension “PostTitle”, and attach it to the third custom dimension
From there, find the “More Settings” dropdown, then the “Custom Dimensions” dropdown under that.Add an Index of 3 to match the index you previously set up in Google Analytics. Then, select the block on the far right, and select the User-Defined Variable you set up previously for the page title.
To begin adding the page title data to Google Analytics, click “Submit” in the top right.After that, Google Analytics will track the page title on every page view, and allow you to track your top posts labeled by title on an ongoing basis.
The dashboard pulls custom dimensions 1, 2 and 3 from your Google Analytics account, so if you used those three slots for author, publish date and page title, the data will immediately populate.
It shows your top blog authors based on all posts published in their name, so your team can get competitive over the data for the month or year.
It also looks at pageviews and bounce rate for all your latest posts, so you can see which recent posts are the highest quality, and which ones are helping you hit the month’s traffic goals.
If there are any other custom dimensions that you would like to track, let me know in the comments. I am curious to learn about the other ways that content marketers analyze their content.
| May 27
| May 26
| May 25
Latest from our blog
Popular Blog Posts
POPULAR DASHBOARD EXAMPLES & TEMPLATES