Tag Manager puts tracking code behind one snippet you manage online. It suits sites with several tags that change often. Before moving Analytics, list every tag and setting, and remove the old code as the new tag starts.

Code added over the years

Open the code of a typical small business page and it is crowded with snippets: the Analytics code, a conversion tag from an AdWords campaign, a remarketing tag, a social button script and perhaps a chat box.

Each was pasted into the template by a different person in a different year. Some still matter, some belong to campaigns long finished, and changing any of them means editing the site.

Google released Tag Manager yesterday to deal with exactly that. It is free, and it changes who edits that code and how.

What Tag Manager does

A single snippet, called the container, goes into the site's template once, just after the page's body begins. From then on the tags themselves live in a Tag Manager account rather than in the pages.

In that account you add a tag, say which pages it should run on, and publish. The container loads whatever is currently published, so a new tag can go live without anyone opening the template.

Ready-made templates cover Google's own tags, such as Analytics and AdWords conversion tracking, and a custom tag covers the rest. Each published set is kept as a version, so an earlier one can be restored.

What usually sits in the code

Before anything moves, it helps to know what is there. On a small business site the list is often longer than anyone expects.

The second and third are easy to miss, because they sit inside individual pages or links rather than in the template. Both were written to work with the Analytics snippet in its usual form.

When it helps

Tag Manager earns its place on sites with several tags that change: seasonal campaigns, conversion tracking on more than one form, remarketing, and someone outside the business managing the advertising.

It also helps when the person running the advertising is not the person who can edit the site. Instead of waiting for a developer to paste in a snippet, the change is made and tested in the account.

And it gives one place to see every tag on the site, which is worth having even if little else changes.

When it adds little

A five-page site with the Analytics snippet and nothing else gains little. There is one piece of code, it rarely changes, and moving it adds an account to look after without removing anything.

Tag Manager is also one day old. Waiting a few weeks while others find its rough edges is reasonable for any site that is not about to add new tags.

Checking the Analytics code first

Find out which version of the Analytics code each page carries. Older sites may still run the original code, or two versions at once on some pages.

Look inside the snippet for added lines, such as settings for tracking across two domains, a changed sample rate or custom variables. Each has to be set up again in the new tag.

Then search the pages for event and ecommerce code. It needs testing against the new arrangement before the old snippet goes, because it was built around that snippet.

Counting every visit once

The easiest mistake to make is running both at once. With the old snippet still in the template and the new tag published, every page view is recorded twice.

The opposite mistake is removing the old snippet a day before the new tag is published, which leaves a gap in the reports.

Plan the switch as one change: publish the tag and remove the snippet together, then watch the real-time report while someone clicks through the site.

Mark the changeover day in Analytics with an annotation, so a later comparison of figures shows exactly when the code moved.

A worked example

A tent rental company in the Comox Valley puts up marquees and frame tents for weddings, festivals and company picnics, and runs AdWords campaigns each spring.

Its office manager asked yesterday whether Tag Manager would help. The first step was a list of what the site's pages already carry.

The list held the Analytics snippet with a setting for the booking calendar on a separate domain, event code on the brochure download, two conversion tags, and a remarketing tag still running months after its campaign ended.

The plan is to install the container, retire the remarketing tag, then move the conversion tags one at a time, testing each in preview.

Analytics moves last, with its cross-domain setting rebuilt in the new tag and the brochure event tested before the old snippet comes out of the template.

Moving in that order means the tag that would hurt most if broken moves only after the process has been tried on tags that matter less.

Who can publish

Anyone who can publish in Tag Manager can put code on every page of your site. That is as much power as the password to the site's files, and it deserves the same care.

Give each person access through their own Google account, keep the list short, and remove people when they leave or a contract ends.

A tag added by someone outside the business, for a service you have never heard of, should prompt a question before it is published.

The counter-case

Plenty of sites can leave Tag Manager alone for now. With one Analytics snippet, no other tags and no plans for more, the code is fine where it is.

Where tags are many and change with each campaign, one managed place with a record of every change beats a template edited by whoever was available.

Set up carefully, with the old code removed as each tag moves, it gives code the site already has a tidier and safer home.

Moving the Analytics code

  1. List every tag on the site, page by page.
  2. Note custom settings inside the Analytics snippet.
  3. Find event and ecommerce code in pages and links.
  4. Retire tags for campaigns that have ended.
  5. Install the container and move tags one at a time.
  6. Publish the Analytics tag and remove the old snippet together.
  7. Watch the real-time report and annotate the date.

Step six needs planning rather than improvising. Done in two stages, it leaves either a gap in the figures or a stretch in which every page view counts twice.

For telling which version of the Analytics code a site runs, and why its place in the page matters, read tracking code at the bottom of a slow page.


Frequently asked questions

What is Google Tag Manager?

A free Google service released on October 1. One container snippet goes on every page, and the tags it loads are added, changed and published from an online account.

Does a small business site need it?

Not always. A site with only the Analytics snippet gains little. It helps most where several tags change with campaigns and different people manage them.

Will my existing Analytics data carry on?

Yes. Use the same web property ID in the new tag and the reports continue as before. Only the way the code reaches the page changes.

What happens if both versions run?

Every page view is recorded twice, and figures such as the bounce rate stop meaning anything. Remove the old snippet at the moment the new tag is published.

What about event tracking written into links?

That code was written for the old snippet. List it before the move, test it in preview with the new tag, and rewrite whatever fails.

Who should be able to publish changes?

Only people you would trust with the site's files. Publishing puts code on every page, so give each person their own access and remove it when they leave.

West Coast Media Solutions Inc. provides web design, web development, hosting, digital marketing, and business consulting to organisations across Canada, drawing on more than twenty-five years in the field.

Code from five campaigns in your template?

Let us list every tag your pages carry, and we will plan a move that counts each visit once.

Start a Conversation