Let us continue our journey of exploring Google Tag Manager’s features from where we left off in part 1 after covering features like fields to set, tag sequencing and priority. In this blog, we will have to look into some delicate configurations of Universal Analytics tags like Global function name and Tracker Name – which if you use wisely – becomes a blessing or has the potential to even be a curse for the data. Once we’ve looked at these features in detail, we will then dive into auto event variables and finally cover the history event based triggers and variables. These features resolve a lot of day to day issues of tracking and you don’t need developers’ involvement at all.
- Global function name & Tracker Name
Analytics.js has a global function named “ga”. If you want to change the global function name, you can do so by using this feature. You can find it under UA tags -> advanced configuration -> Global Function Name.
This can be useful if your existing ga function is overridden by the other on page function (or is also may be pushed by a third party script).
image: global function name setting
Tracker Name is a tricky configuration that even GTM does not encourage using.
GTM basically assigns a unique tracker to each tag. If two tags are set in the same tracker name, then configuration of both tags will be shared. Every setting in fields to set works as below
Hence, if you have used the “tracker name” setting, it will be shared across all tags.
For example, as we see here in one tag, I have set a virtual pageview using fields to set page and another tag, with the same tracker name, as an event tag.
Image: tracker name shares the configuration
Now, the dp parameter will be the value of that virtual page view tag that has been set for the earlier tag as well. (Please use it after thorough audit of data according your use case or get in touch with us in case you need assistance)
- Auto event variable
Though most of the variables listed under this, are already available in Configure variable section, there are a couple of useful types present under it like “Element Attribute” and “Element URL”. Also available as a separate variable is the one called “URL variable”.
With “Element Attribute”, you can get any data attribute or other attributes associated with that particular element. Element URL further has other hidden gems like Fragment, Full URL, Protocol, Page, Path Query Parameters, Port, Hostname.
Image:Auto Event Variable
- Setting up Auto event tracking with data-attributes only
- Leverage URL’s different part and can be used to set Variables, set Triggers
- Set up internal site search using GTM
- History change for modern website
Pageview Trigger only works when the entire page document is loaded from server. So if your website does only dom manipulation to update some of the parts of web page or simply it does not load new page every time from server, the history change trigger serves as a cherry on the cake for your GTM implementations.
You can use the “History Change” trigger just like you did pageview in such a case where you also have some inbuilt variables in GTM like New History Fragment, Old History Fragment, New History State, Old History State, History Source to complement the usage of this trigger.
- Fire pageview tags for one page websites
- To set up triggers in tags for many different use cases
The set of features explained in this blog have critical impacts on your GA data. So, be sure that you’re careful while implementing it and be fully aware of the implications that it would have on your data collection. We have tried to cover small set of useful features in this series of blogs and are coming up with a few more so as to give you a holistic idea of what GTM can do for you. The upcoming part of this blog series will cover the awesome lookup tables, environment setup with detailed explanation.
We would love to know your inputs and queries, please feel free to leave us a comment in the below section.