Put every tracking code into Google Tag Manager, a container the business owns, and move them across one at a time, removing each pasted copy as its replacement goes live so nothing counts twice.

Five people, five snippets

Open the source code of a typical small business home page and you will find several blocks of tracking code, each pasted in by someone different at a different time.

The developer added Analytics. A consultant added AdWords conversion code. Whoever ran the Facebook page added a pixel, and an agency added a remarketing tag for a campaign long finished.

Nobody kept a list. Some codes run on every page when they belong on one, some are missing where they matter, and one is often there twice.

The reports built on them look precise. They are only as accurate as the pasting.

What is usually in there

The fifth quietly distorts everything else. Two copies of the same Analytics code record every page view twice, and the reports describe a busier site than the real one.

How the figures go wrong

Duplicate Analytics has a recognisable signature: page views roughly double and the bounce rate falls close to zero, because no visit ever registers just one page.

Conversion code in a site-wide footer treats every ad visitor who opens a page as a conversion, so AdWords reports more enquiries than the inbox ever received.

The opposite failure is quieter. A pixel on the home page alone never sees a booking confirmation, so the ad account cannot tell which ads produced bookings.

None of it shows as an error. The site works, the reports fill, and the numbers are wrong.

Codes tied to accounts nobody controls

Each snippet reports to an account, and when the person who pasted it moves on, the data keeps flowing to wherever they set it up. A former agency's remarketing tag may still be building audiences in that agency's account.

Deleting a code nobody can identify feels risky, and leaving it is no better. The first job is a list: what each code is, which account it reports to, and who can log in to that account.

One container instead of many snippets

Google Tag Manager is a free tool that replaces the separate snippets with one, called a container, pasted on every page just after the opening body tag.

The tags live inside the container, each with rules, called triggers, deciding which pages it fires on. Conversion code can then fire on the thank-you page alone without anyone editing a template.

Changes happen in Tag Manager's own screens, so a consultant adding a tag no longer needs access to the theme or the hosting.

A record of who changed what

Each published change is saved as a version, with the date and the login that published it, and an earlier version can be put back in minutes if something breaks.

Access is set person by person: view, edit or publish. Create the account under a Google login that belongs to the business, add everyone else as users, and remove contractors the day their work ends.

Then agree one rule with everyone involved: nothing gets pasted into the templates any more. If it is a tracking code, it goes in the container.

A worked example

A karaoke business with six private rooms in a suburban plaza takes most of its bookings online, for birthdays, office parties and Friday nights out.

Over four years, five people had touched its site. The developer put Analytics in the header, an AdWords consultant put conversion code in the footer, and a staff member added a Facebook pixel to the home page.

A booking add-on brought its own snippet, and a second developer later installed an Analytics plugin using the same tracking ID.

The result was a bounce rate near zero, AdWords reporting more bookings than the rooms could hold, and a Facebook audience that never included anyone who had booked.

One evening fixed it. Every code was listed, rebuilt in a container, checked in preview and switched over one at a time, each pasted copy removed as its replacement went live.

The owner now publishes every change, and the figures match the booking calendar closely enough to act on.

Moving the codes across

Start with an inventory. View the source of the home page, a service page, the thank-you page and the booking confirmation, and note every snippet, its account number and where it lives.

Google's free Tag Assistant extension for Chrome lists the Google tags on each page and warns about duplicates, which speeds this up.

Then add the container to every page; while empty, it changes nothing. Build each tag with its trigger and check it in preview mode, which shows the tags fired on each page, before publishing.

Avoiding the double count

The switch is where most moves go wrong. Publish the new Analytics tag while the old snippet is still in the theme, and every page view counts twice from that day.

Move one code at a time: publish its tag and remove its pasted copy in the same sitting, then load a page and check that the real-time report shows it once.

Add an annotation in Analytics on the day of each switch, so nobody mistakes a corrected count for a bad month.

The counter-case

A small site running Analytics alone, installed once and owned by the business, gains less from Tag Manager. One code in one place is already manageable.

Tag Manager cannot reach pages the business does not host, such as a booking system on another company's servers; those need the provider's own instructions.

And a container lets anyone with publishing rights put any script on every page, so publishing belongs with one or two trusted people.

For most sites carrying more than a couple of codes, though, one container owned by the business is simpler and more accurate than snippets scattered through the templates.

The order to do it in

  1. List every code on the key pages.
  2. Note the account each one reports to.
  3. Retire codes whose accounts nobody can open.
  4. Create the container under the business's own login.
  5. Rebuild each tag and test it in preview.
  6. Switch one code at a time, removing its copy.
  7. Annotate each switch in Analytics.

Step six is the one that protects the figures. A new tag published before its pasted copy comes out doubles the count from that day, and the reports never say so.

Old event tracking hidden in those snippets needs rebuilding too, as covered in upgrading to Universal Analytics without losing events.


Frequently asked questions

Why does duplicate Analytics code matter?

Two copies record every page view twice. Page views roughly double and the bounce rate falls close to zero, so the reports describe a busier site than the real one.

Where should AdWords conversion code go?

Only on the page people reach after converting, such as the thank-you page. In a site-wide footer it counts every ad visitor as a conversion, whether or not they got in touch.

What does Google Tag Manager actually do?

It replaces separate snippets with one container on every page. The tags live inside it, each with a trigger deciding which pages it fires on.

Can I see who changed a tag?

Yes. Each published change becomes a version with its date and the login that published it, and an earlier version can be restored in minutes.

How do I avoid counting visits twice?

Move one code at a time, publishing its tag and removing the pasted copy in the same sitting, then check the real-time report shows each page view once.

Who should own the Tag Manager account?

The business, under its own Google login. Developers, agencies and consultants get user access, and lose it the day their work ends.

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.

Tracking codes from five different people?

Tell us your website address and we will find every code on it, the account each one reports to, and any that count twice.

Start a Conversation