GA Settings Variable in GTM for Customized Campaign Source, Medium & Channel Grouping

Using the Google Analytics settings variable in Google Tag Manager, a lot can be achieved. Most of it includes customizing Google Analytics settings variable functionality. These settings can be either changed at the tag level or at the variable level itself. We are going to see both of these options in this article.

Google Analytics Settings: Variable & Tag level

Once defined at the variable level, the customized variable can be used with any trigger or tag by associating the variable. This option gives much more flexibility. On the other hand, if you customize the settings at the tag level by overriding the default values, the modified values only apply at the tag level.

So, if you want to make universal changes, customizing the GA settings variable at the tag level is a better idea. On the other hand, if you are looking for better control, then the variable level is the better option.

Google Analytics Settings Variable Use Cases

Some of the use cases of Google Analytics settings variable at tag level are:

Content grouping using GTM

Content grouping using GTM

If you want to know how the Google Analytics Settings variable was used to achieve these settings, here are some links:

However, today I did not just want to talk about these fields. One of my favorite fields in a GA settings variable is “fields to set”. A lot can be achieved using this advanced field itself. Some of the things that you can achieve by customizing the “fields to set” fields are:

  • to know about the system info such as screen resolution, screen color or viewport size etc.
  • defining the hit type such as pageview, screen view, event, transaction, social etc.
  • creating and tracking cookies from different sources
  • defining source, medium, keyword, content, Id etc. for a campaign

I cannot cover all of them here. In this article, we are only going to see how to make use of Google Analytics settings variable to define the source, medium, keyword etc. for a traffic source.

GA Settings Variable: Campaign Source, Medium & Channel Grouping

Campaign Source & Medium in GA Settings variable

Campaign Source & Medium in GA Settings variable

If you see above, I have set the campaign source as AddThis and campaign medium as internal. What do I want to achieve with this?

Channel grouping Scenario:

I have the AddThis plugin installed on my travel blog. This plugin is used to generate post recommendations in form of cards in the middle of each post after some specified number of paragraphs. This is to keep my user engaged in my blog.

Also read recommendations cards by AddThis

Also read recommendations cards by AddThis

Now, let us say that I have more than one content recommendation plugin on my WordPress blog. One is AddThis and the other one is inline related posts. Both of these plugins offer me values in terms of content recommendation. Would not it be a nice idea to see these traffic on different channels’ source & medium? So, let us see how do that?

Creating a separate GA variable for different possible channels

My next step would be to create a different Google Analytics settings variable to capture traffic from different sources and route them through customized source & medium. But wait! Is that not already available in Google analytics settings? Yes, it is! Nonetheless, these customizations are limited to the default capabilities of Google analytics. Something as internal traffic which we want to measure is not available through Google analytics settings.

  • Go to variables in GTM
  • Create a new variable as Google Analytics Settings
  • Under fields to set, select campaignSource & campaignMedium in two fields
  • Give a name to your source and medium
  • In my case, the source is AddThis and the medium is internal.
Campaign Source & Medium in GA Settings variable

Campaign Source & Medium in GA Settings variable

Create a trigger to write a logical rule for the above traffic

Well, now that we have our GA settings variable defined, it is time to define that campaign source and medium. In my case, I am going to capture all the clicks on the recommendation card provided by the AddThis Plugin. It is a simple rule as shown below. This part is the tricky part because you need to define the trigger rule precisely for the right data.

Creating a Tag to fire to capture above traffic

  • Create a tag as Google Analytics
  • Set track type as a pageview
  • Under Google analytics settings, select the variable that you just created
  • Publish the tag

Tag configuration for different GA Settings variables

Look for Customized channel source/medium

GTM part is over. If you have done everything right, Within 24 hours, you will start to see your new source/medium under the channels. Up to this point is also fine. But you can also take another step further. How? By creating a channel grouping for this customized channel.

Custom channel source and medium in GA

Custom channel source and medium in GA

Create a customized channel group in GA

Under the Channel grouping, create a new channel in Google Analytics and put the source and medium as defined above. Here is a detailed guide on how to create Channel Grouping in Google Analytics to Segment Data Logically.

Leave a Reply

Your email address will not be published. Required fields are marked *