How To Get Blog Post Category From Squarespace To Google Analytics: DOM Method In GTM / Solution# 2

In the previous post on this topic, I covered how to scrape the DOM element value for the blog category and pass it as a variable and then into GA.

Here's the link to Solution #1 for getting blog post category from SquareSpace to Google Analytics.

A really quick recap is that we create a DOM element variable, define a trigger that includes this variable and then fire an event where action can be the DOM element {{Blog Category}} and label {{page path}}.

This is one method. The other method can be to use custom dimensions. 

Why would one use custom dimensions?

Here are some good examples of custom dimension usage from a Quora thread.

Even though knowing the blog category is fine, we need to first create a CD in Google Analytics and then decide the scope [hit, session, user]. This is important for GA to understand how this dimension operates.

e.g. If we chose hit for blog category, we would get hit metrics such as pageviews

If we choose session, then all the pages seen in a single session would get classified with the page category of the last page.

If we chose user, we would classify the user as a reader of a particular blog category type [so everytime this user shows up, the same category would be assigned].

A more detailed example is explained here.

In the blog category page, it would a hit metric.

Once we define a CD in GA, we then go to GTM for the tag.

In the event method, we created a event based trigger. In CD page. we create a pageview trigger instead where the CD matches the blog category.

and you're done. Once in GA, you can now combine it with other dimensions to create hit level reports and analyze the data more easily.