RELEASE: GTM Tools V2.0
(UPDATE 3 Apr 2017: There is a newer version of GTM Tools out, so please ignore this article and read this one instead.)
So, the time has come to update my GTM Tools. I released the first toolset in October 2014, and it performed its duties just well enough. Sure, the UI was ugly as hell, and there were bugs along the way, but for cloning containers, macros, and rules, and for visualizing containers, it was just good enough.
I’ve been working on a new version of the toolset, designed specifically for accounts created in the new UI of Google Tag Manager. There’s no “backwards compatibility”, so this version of GTM Tools will, as I wrote, only work with accounts and containers created in the new UI.
This article is intended to be the “User guide” for the tool, so I’ll jump straight to the subject matter right after this disclaimer:
I am not a professional product developer, and GTM Tools v2.0 is not a commercial product.
This toolset is my own, personal, intellectual property, with no purpose of making money out of it or making it the best possible product out there. It’s got bugs, the code is pretty nightmarish in some places, and I haven’t done thorough testing. It’s a toolset that you might find useful or then you might not.
I would still appreciate that you e-mail me (simo(at)simoahava.com) any bugs, errors, or freezes that you come across. Just remember to check the Known Issues part of this guide first.
The tool is located in this URL:
Table of Contents
1. Login And Authentication
GTM Tools v2.0 uses your Google Account for authentication. This means that when you first open the tool website, you will need to Sign in with your Google credentials.
Once you’ve signed in, you will need to authorize GTM Tools v2.0 for access to Google Tag Manager and your Google profile. Specifically, here are the authorization scopes you allow access to:
If you refuse to allow access, you will not be able to use the toolset.
Once you’re in the actual tool interface, you can see the profile you’ve logged in with in the upper right corner of the page. You can click this link and Sign out of your Google Account at any time, or you can click Account to access your Google Account settings.
2. Home Page
The first page you’ll see in the tools is the home page. This page is a placeholder, and you should use the navigation bar in the top of the page to move on in the site.
The navigation has the following selections in the home page:
Home – Takes you back to the home page
GTM Account – This lists all the GTM Accounts you have access to with the signed in Google Account. Note that this list includes GTM Accounts created for the old GTM interface, but these will not work in GTM Tools v2.0, so try to avoid accessing them.
Library – Takes you to the Asset Library where you can find your stored Containers
Cart – Shows you how many items you have in your Cart, and by clicking the button you will be taken to the Cart page
Your Profile – Clicking this shows a drop-down menu, where you can choose to access your Google Account settings and/or Sign Out of your Google Account.
3. Account Page
**NOTE!** Due to processing reasons, you will only be able to interact with a **PUBLISHED VERSION** of any given Container. If there is no published version, you will not be able to perform any actions on the Container. This is something I intend to fix as soon as the API provides better access to the Container Draft.
When you choose a GTM Account in the Accounts navigation, you will be taken to a page that lists all the Containers in the selected GTM Account. If you click a Container name, you will be taken to the respective Container page.
If you click the small down arrow next to a Container name, you’ll see quick links for the following Container actions:
Inspect - Takes you to the Inspect Container page, where you can view information about the Container, and where you can add / remove assets from the Container into the Cart
Visualize - Takes you to the Visualize Container page, where you can view a visualization of the Container
Clone - Opens a modal dialog that lets you clone this Container
Read more about these actions in the following sections of this guide.
4. Container Page
The container page is here more for structural reasons than to add any added value. You can move through it to the individual actions (Inspect, Visualize, Clone), which you can also do from the Account page, as you just learned.
The following chapters will include details about the various actions you can take.
On the Inspect Container page, you can see a list of all Tags, Triggers, and Variables in a Container. You will also see information about the current published version by clicking the Version Information panel.
The number on the right-hand-side of a panel title tells you how many assets are in each respective category.
By expanding an asset category, you’ll see a list of all the assets under that category.
You will also see three buttons:
Green plus + for adding the asset to your Cart
Red minus - for removing the asset from your Cart
yes in the Links column if there are dependencies (i.e. linked assets) that you should probably add to your Cart as well
The green plus will be greyed out if the asset is already in the Cart, and the red minus will be greyed out if the asset is not yet in the Cart. If there are no dependencies, you will only see a dash in the “Links” column.
Do not add an asset to Cart if another asset with the same name has already been added. This is not supported by the current version of GTM Tools v2.0, and I haven’t yet prevented this in the code.
When you click on the yes button for dependencies, a modal dialog will open up which lists all the dependencies of the current asset. This means that these dependencies are linked to directly from the asset itself, or from one of the linked assets. It’s strongly recommended that you include all linked dependencies when adding an asset to the Cart.
You can add a dependency to the cart by clicking the Add link, after which you’ll see the text Added next to the dependency.
The Visualize Container page first shows you a brief description of what the tool does. Once you click the Start visualization button, a full-screen modal dialog will open, and you will be able to see a visualization of all the assets in the Container as well as any links between them.
The asset colors are:
Grey - Built-In Variables
Green - Tags
Blue - Variables
Red - Triggers
If you hover your mouse over an asset, any links to or from that asset will be highlighted. The path color is red if the link is from the selected asset, and the path color is green if the link is to the selected asset.
Hovering over the asset will also show information about it in the small box that appears in the center of the visualization.
Clicking an asset name freezes the paths, so that it’s easier for you to navigate to the other end of the path.
Clicking Select Hermit Nodes will highlight all the assets that have no links to or from other assets.
You can use the search box to find assets. Start typing, and the assets that match whatever you’ve typed will be highlighted as you type.
There are two ways to clone a Container in GTM Tools v2.0. Due to architectural reasons, they are a bit different.
The first way is through the Account page and the Container page. So either you choose Clone Container from the drop-down menu next to the Container name in the Account page, or you click the Clone Button on the Container page itself.
When you choose this Clone option, you will be able to choose the GTM Account where this Container will be cloned to. You can also choose the same GTM Account as the one from where you’re cloning the Container from.
Once you’ve chosen the Account and clicked Clone, the process begins, and the source Container with all its assets is cloned to the target Account.
If there already is a Container with this name in the target Account, the Container name will be prefixed with “copy of “ during the process.
The second way of cloning a Container is with your custom-created Containers. This means that you choose to Clone either directly from the Cart page or from your Asset Library page.
If you choose this option, it will be possible to merge the stored Container with an existing Container, or you can choose to create an entirely new Container, if you wish.
If you choose New Container, you will need to give the new Container a name. When you click Clone, the new Container will be created in the target Account, and all assets are cloned. If there is already a Container with this name, the new Container’s name will be prefixed with “copy of” during the process.
If you choose an existing Container, the contents in your Cart or in the stored Container will be merged with the assets in the target Container. This means that if there is a naming conflict, i.e. an asset with the same name already exists in the target Container, the asset’s name will be prefixed with “copy of”, and any links to the asset in other cloned assets will be updated accordingly.
Renaming Containers and assets like this makes merging Containers possible while still preserving the established links between assets in the source Container.
If you choose to merge the assets to an existing Container, no existing assets in the target Container are modified in any way, so you don’t have to worry about data or integrity loss.
Once the Cloning process begins, there’s no way to interrupt it.
5. Cart Page
On the Cart page you can see all the assets that you have stored in your Cart. You store assets in the Cart through the Inspect Container page. The assets are listed first by GTM Account name, then by Container name, and finally by asset type.
Clicking the Remove link next to an asset removes the asset from your Cart.
Clicking the Clone to container button opens a modal dialog that lets you clone the Cart contents into an existing Container or a new Container.
Clicking the Save cart button opens a modal dialog that lets you save the Cart contents into your Asset Library. This way you can save your favorite Container configurations to be used later.
Clicking the Empty cart button flushes the Cart contents.
6. Asset Library
The Library page shows you all your stored Containers. When you click a Container name, you will see how many Tags, Triggers, and Variables are in the stored Container. You’ll also be able to see when the Container was created, as well as the description you gave the Container when you saved it.
Clicking the Clone button lets you clone this Container into an existing Container or a new Container.
Clicking the Visualize button takes you to the Visualize Container page, where you can see a visualization of all the assets stored in the Container.
Clicking the Delete button opens a modal dialog which confirms this action. If you choose to delete the Container, you’ll see a success message shortly, after which the page will automatically reload.
7. Known Issues
Here are some of the issues I know exist in the toolset.
If you try to access accounts created in the old version of GTM, you will run into trouble. Unfortunately, there’s no way to weed these out efficiently. This won’t be a problem after all accounts are migrated to the new GTM.
You can add an asset to the Cart even if another asset with the same name is already in the Cart. However, if you do so, you will run into an error when trying to clone the Container. I’m going to prevent this is the code, but it didn’t make it into this version.
Currently, all Container actions work only with published versions of the Container. This is a limitation, and I hope to improve it as soon as the API provides better support for accessing the Container draft. At the very least, I intend to allow you to choose the version you want to interact with.
Most common cause for errors is with naming conflicts. I’ve tried to fix most of these by automatically prepending “copy of “ in front of the Container or asset you’re trying to clone, but I may have missed some use cases.
I cache most of the things you work with to reduce the number of API calls that are made. However, the cache is purged for Containers and assets whenever significant changes are made. Nevertheless, there might be situations where you don’t see a change even though you just performed an operation with the tools or did something in the GTM interface. In this case, I suggest you wait 15 minutes and then check again, as that is the expiration time for the cache. I will add a switch to manually flush your own cache, but it’s not in this version yet.
8. Latest releases
17 Nov 2016
Updated error handling to be more informative and less intrusive.
Migrated from the Channel API to Firebase Realtime Database. As a result, the progress bar is slightly slower (working on it), but it’s more stable.
Created a new container for Library storage since the first one was full. Sharding is done automatically.
Minor refactoring here and there, but the codebase is still pretty awful.
10 Dec 2016
- Migrated from cookies in Cart storage to AppEngine Datastore.
As I hopefully made clear in the introduction, this toolset is my own playing ground. It’s not a fully-formed platform, it’s not a sponsored product, and it doesn’t have a team of engineers working on it 24⁄7. Thus I hope you will find it useful, and I’ll do my best to fix bugs and new features, but don’t expect Premium-level support from me in making things right.
Use the toolset at your risk.
There’s no risk to your existing assets, since I don’t have any overwrite features in the toolset. The only thing you can botch up is cloning something into something else, and in that case only the thing you were cloning will suffer. Easy enough to clean up afterward in your GTM account.
I still hope you find the toolset useful, and I would very much appreciate any feedback that you might want to direct to my developer team (i.e. me).