Publishing tags, and making sure that your code works BEFORE you push it to the live site is really, really important part of tag management and container tags. Because a container tag mistake can cause many problems on your site, it’s really important that you have some process to control who and when updates are made to your tags.
That’s why Google Tag manager has a Preview and Publish mode to let you test your tags before they go live on your site. And I must say, I think this is one of the best features of Google Tag Manager.
Here’s a quick video about previewing and publishing tags, or read on for more details.
As you make changes to your GTM containers, the modifications are NOT automatically pushed out to the live site. They are only saved in your account. You need to explicitly publish them to your site.
But, before you publish changes you should test your tags to make sure there are no negative effects to the site. And to do that, you need to know about creating container versions.
Understanding Container Versions
A container version is basically a snapshot of the GTM settings for a specific container. It’s mandatory to create a new version before you preview a container or publish a container.
To create a new version of your container navigate to Versions section of GTM. Then use the Version button in the top right of the screen to create the new version.
Once you have a new version you can preview the version or you can publish it.
TIP: You can “roll back” your container tag to a previous version if there is ever a problem. Just click on the version that you want to “roll back” to and click the publish button in the top right corner.
Previewing A Container
Preview Mode is a way for you, and only you, to view the tags to make sure they fire. It works by setting a special cookie on your machine so only you will be able to see the preview.
To enter into preview mode choose the version that you would like to preview. Click the Preview button in the top right corner of the page and decide if you want to preview and debug or just preview.
Once you decide you’ll get a dialog window that you can dismiss or use to exit preview mode. It will also container a list of the domains that have your container. Click on a domain to start viewing the site in Preview mode.
If you choose preview & debug you’ll notice a frame at the bottom of the page. It indicates all of the tags that are supposed to fire on the page and which ones actually do.
So what happens if a tag does not fire? Time to start debugging! I’ve found that the most common problem has to do with the rule settings. Make sure your rules are correct and not blocking a tag from firing on a page.
If your rules are correct, try checking some of these other ideas for debugging and troubleshooting Google Tag Manager.
TIP: A really cool feature is the preview perma-link. When you choose Share from the Preview menu on the Versions screen, GTM will create a permanent URL for the current preview, so you can share it with a co-worker.
Publishing A Container
Publishing a container is very similar to previewing a container. You need to publish from the Version section of GTM.
Once you click Publish your updated container should appear almost instantly on the site. If you’re not seeing the tags then doing a hard refresh of your browser. If you’re still not seeing the changes try some of these Google Tag Manager debugging tips.
As I mentioned before, I think Preview and Publish mode is one of the best features of Google Tag Manager. Make sure you take advantage of these tools and avoid any tagging mistakes.