A Google Tag Manager (GTM) container is a set of macros, rules, and tags within a GTM account. Containers can be exported from one account and imported into another to save time and increase efficiency. When a GTM container is exported, it exists as a piece of JSON code.
I’ve created several useful GTM containers. You can download any of my GTM containers for free. Using a few easy steps, you can vastly improve website functionality.
How to Import a Container
Once you’ve downloaded your GTM container, follow the below steps to import it. If you want to go straight to the downloadable containers, scroll down.
- In Google Tag Manager, click the admin tab
- Under Container, click “Import Container”
- Choose the following settings on the “Import Container” page:
- Select a file to import -> choose the file you just downloaded
- Choose workspace -> Existing -> Select your existing workspace
- Choose an import option -> Merge (Unless otherwise specified)
- Click on variables in your GTM workspace. Under User-Defined Variables, look for a variable named UA-XXXXXXXX-X (or something similar).
- If this variable exists, change the name and value of the variable in your Google Analytics UA code. If you are unsure where to locate your UA code, visit Google Analytics > Admin > Property > Tracking Info > Tracking Code
GTM Container Recipes
GTM Container Recipe #1
Track Pageviews in Google Analytics
This script is all you need to get Google Analytics pageview tracking functioning correctly through Google Tag Manager. Simply import the container and enter your UA code as explained in step 4 above.
GTM Container Recipe #2
Track Contact Link Clicks in Google Analytics
This container enables you to track contact link clicks on your website as Google Analytics events. If a website visitor clicks on a “tel:” or “mailto:” link on one of your pages, an event is recorded by Google Analytics. You can find the event action in Google Analytics under the Real-Time > Events report, or view historical aggregate data under Behavior > Events > Overview.
GTM Container Recipe #3
Cross-Domain Tracking
Cross-domain tracking is a way to analyze visitors across multiple websites in a single analytics view. Implementing cross-domain tracking grants you access to multiple website traffic channels as if they were a single website. If you are looking to implement cross-domain tracking, download the script here and check out my article – set up cross-domain tracking with Google tag manager in 7 easy steps.
GTM Container Recipe #4
Clear GTM Container
This functional GTM container helps website owners test new implementation. This container clears all tags, triggers, variables, and folders from your GTM implementation – allowing you to start fresh. Be sure to select “overwrite” when importing this container.
GTM Container Recipe #5
Track Copied Text in Google Analytics
Interested in knowing which text is copied on your website? Import this GTM container and an event will be sent to Google Analytics every time your website visitors copy text to their clipboards.
Here’s a working example:
As a bonus, the event label is set to the copied text, so you can see the exact text copied right in the Google Analytics interface.
GTM Container Recipe #6
Add Link to Website in Copied Text
In container 5 above, I showed you how to track when text is copied from your website to a visitor’s clipboard. This container is similar in that it also tracks copied text, but this time for the purpose of adding a custom message to the user’s clipboard. This seems to be most often used to add a reference link to the clipboard text. A good example of a website that leverages this functionality is BrainyQuote. As an example, I copied a quote from BrainyQuote’s Scooter Braun page to my clipboard (see image below).
When pasted, the following text was output:
I want to show that you can be a successful entertainment executive, be a good husband, be a good father, be a good friend, be down to earth, be a good person, and give back. If I can push that message out there into the world and pass it on to my son, then I’m OK.
Read more at: https://www.brainyquote.com/quotes/scooter_braun_884325
Note that “Read more at…” was appended to the copied text. This script will enable you to add similar functionality to your website. To get this functionality on your website, simply download the container and import it into your GTM workspace.
Conclusion
GTM containers help simplify otherwise confusing or laborious website code install issues. Website owners can quickly add new code with little hassle. Install downloadable GTM containers with ease and save time. These containers also add sophisticated functionality to your website.
If you like this post, you might also like my free Google Data Studio report templates article. Similar to this post, it contains a few preconfigured resources that may be of help.
To get more information on this topic, contact us today for a free consultation or learn more about our status as a Google Premier Partner before you reach out.