If you're an online publisher using Google Analytics, I'm sure you've heard this before: you need to use custom variables so that you can really segment and measure your audience.
You also most likely are currently working on migrating to Google Tag Manager in order to make your life easier.
So how do you implement them together? What follows is a step-by-step guide for installing publisher-centered custom variables using Google Tag Manager.
I am going to assume, that you already have Google Tag Manager installed in your site and that one of your tags is the asynch GA js. If you don't, read this first.
Google's Justin Cutroni recommends adding seven custom variables for publishers. This article will go in detail and breakdown how to install four of them:
CategoryContent TypePublication DateAuthorThese four custom variables at the most basic level gets you a good idea of your overall site performance. Once you add these data points, you can also get closer to information that other publisher-centered analytics tools such as Parsely track.
Let's jump in!
3 Things You Need to Know Before You BeginThese custom variables should be implemented on the page level. For all the custom variables mentioned above, the value changes as the user goes from one page to the next. For example, a user might read an article by author one and then click on a link that goes to an article by Author 2. This is true for all the custom variables aforementionedYou're going to need a data layer. Do not pass go, do not collect $200. The best and only way to have these custom variables on your site is via data layer. If you want to read more about this, here's an article that gives a good explanation of how data layers work.You need the help of your front-end engineer. If you don't know this yet, you will, a good analytics person is always good to his or her front-end engineers.Ask your front-end engineer to create a data layer that contains the four custom variables we want to add: Content Type, Author, Category, and Published Date. Direct them to the developer documentation on adding data layer for Google Tag Manager. There are two key things to check in the developer implementation:
Make sure that the data layer comes before the Google Tag Manager code (we inserted ours before the /head tag).I like keeping my values in small caps, this eliminates any potential duplicate entries that could be created due to any weird capitalizations.Check out the way we set up the data layer in one of our sites. The data layer in the source code for that page will look like below.
No comments:
Post a Comment