Basics
Features
Best Practices
Addon Development
Related Docs
Dark Mode

#Tags Best Practices

It's best practice to add Tags where they're actually used. Don't add a heavy script in the Site screen if only one Page needs it. Don't add the same script to every Page individually when it's the Layout that needs it.

Also, create the style where the Tag is used. For example, if you want a font to be used across the whole site, add the Tag to the Site screen and set the font-family in the Site's style. If the font is only used by a single Layout, add the Tag to the Layout and add the font-family rule to the Layout's style.

When you're adding a Tag for verification purposes, like to enable some email or analytics feature, remove it when you're done.

#Google Tag Manager

It may be tempting to add Google Tag Manager containers using the Tags system. You definitely can, and then you can manage the contents of that Tag through GTM, but this can take your site from loading in <100 ms to taking multiple seconds.

If you know what Tags you need, just add them as Tags and have them baked in and optimized during the Build. Otherwise, you will introduce a large load time where the Page will need to load the GTM system, then look up the specific GTM container, then download the scripts defined in the container, then run the scripts which will typically add additional scripts or tags to the Page which will then need to be run.

In addition, most functions provided by GTM can be added using 1-5 lines of standard JavaScript which is much easier to understand and orders of magnitude faster. GTM uses standard JavaScript for all of its functionality, so there is nothing GTM can do that JavaScript can't.

Google Tag Manager also removes the advantage of having a staging site. If you need to change what's in the container in the staging site, this will immediately affect the production site, potentially causing downtime.