Content grouping can be very handy especially when you are a blogger and you want to measure which content category is performing better compared to other content categories. In my case, it could be blog categories. So, I decided to measure the performance of different content categories on my blog and here is how I implemented content Grouping using GTM.
Before we begin, I would suggest you install this GTM plugin on your WordPress website. I find it very handy and it solves many of my implementation problems.
Check for the Data Layer variable
Once you had that plugin successfully on your website. Go into the preview mode in GTM and check for the data layer variables.
You can already see the data layer variable. In the data layer variable, we already have some WordPress variables such as post type, category, tags, author etc. This was made possible after installing the above plugin. For the page category, you can already see that the data layer variable name is pageCategory.
Create a data layer variable for the page category
I created a data layer variable of page category as shown above and publish the GTM container. You can again go into the preview mode in GTM and after refreshing the page, you will see that your data layer variable which you created above is appearing under the variable section as shown below:
Create a new content Grouping in GA Admin
Go to GA admin. Under views, click on content grouping. Create a new content grouping. Remember the Index. By default, it would be 1, if you doing it for the first time. and then save it.
Edit your GA Tracking Tag for content grouping
As shown below, you just need to enable overriding the Google Analytics settings and under content group settings, fill in the Index number and content group variable name which we had created earlier for blog categories.
Initially, Google Analytics will take around 24 to 48 hours to populate the data. But you need to keep on verifying that.
Verify the content grouping
- In Google Analytics, under behavior, go to Site content
- Click on All pages
- Select the content grouping from the drop down as shown in the picture below
Initially, you can see that the fresh data is being shown as not set in Google analytics but after a day or two, it started to show the right grouping.