Any change to a site can remove its tracking code, and Analytics will not warn you. Test with the real-time report after every update, set an alert for a silent day, and annotate any gap.

A cliff in the graph

The monthly report arrives, and the line on the graph drops to almost nothing partway through the month. Visits, pages, enquiries, all of it.

The phone rang as usual through those weeks, and orders kept coming in. The site was fine. What stopped was the counting.

Around that date, a change to the site removed the small piece of code that sends each visit to Google Analytics. Nothing on the site looks any different without it, so nobody noticed.

The data for those weeks is gone. Analytics records visits only while the code is on the page, and nothing can fill the gap afterwards.

How the code goes missing

The second catches sites nobody redesigned. Code pasted into a theme's header file vanishes at the next theme update, which replaces the file with the theme maker's own version, sometimes automatically.

Why nobody notices

Analytics fails silently. There is no error on the site, no warning email, nothing a visitor would see.

Most owners look at their figures monthly, if that, so a gap that starts early in a month can run five or six weeks before anybody sees the graph.

And the person who made the change tested what they changed: the new layout, the menu, the forms. Tracking was not on the list, because it cannot be seen.

The real-time report as a test

The quickest test is the real-time report in Universal Analytics, which shows who is on the site right now.

Open it on a computer, then visit the site from your phone. Within a few seconds the visit should appear, with the page you are on.

Use mobile data, not the office Wi-Fi, if your office's internet address is filtered out of the view. Filters apply to real-time too, so a visit from the office may never show.

Visit two or three kinds of page, including a landing page or the blog. Code can be present on most pages and missing from those built on a different template.

Watch for the opposite fault too: code added twice, by a plugin and again by hand. It counts every page view twice and sends the bounce rate close to zero, which looks like good news and is not.

Test after every change

The test takes two minutes, so run it whenever anything touches the site's templates or code.

After a redesign, before anybody announces the launch. After a theme switch or update, any plugin that adds to the page header, a change of host or a move to HTTPS.

After a new cookie banner that may hold analytics back until visitors agree, and after anybody publishes a change in Tag Manager. Make it the last line of every change list.

A worked example

A commercial print shop in a Surrey industrial park moved its website to a new theme in early May, before its busy season of school and event printing.

A previous web person had pasted the Analytics code into the old theme's header file. The new theme had a box for it in its settings, and nobody filled it in.

The May report, read in the second week of June, showed visits falling to almost nothing from May 9. The owner assumed the website had broken, then noticed the order book had not changed.

The code went back in that afternoon, through a plugin independent of the theme so the next theme change cannot remove it, and the real-time report confirmed it from a phone.

Two annotations now mark May 9 and June 12, each saying what happened. Next spring's comparison will have a hole in it, but nobody will mistake it for a collapse in business.

Annotations that explain the gap

An annotation is a dated note attached to the graphs in Universal Analytics, shown as a small marker under the timeline. Add one from the tab beneath any graph, choose the date and write what happened.

For a gap, add two: one on the day tracking stopped and one on the day it resumed, each saying why.

Shared annotations are visible to everybody with access to the view, so the next person reading the report sees the explanation instead of drawing conclusions from a drop.

Annotate the other changes too, such as redesigns and host moves; they are the first things anybody asks about when a graph moves.

An alert for a silent day

Universal Analytics can send an email when something unusual happens, through a custom alert set up in the view's settings.

Set one for sessions falling below a level well under your quietest normal day, so a holiday does not trigger it. If tracking stops, the alert arrives the next morning instead of the next month.

It is the one part of this that works when nobody remembers to test.

Filling the gap as far as possible

Nothing restores the lost data, but other records show whether the business changed or only the counting did.

Search Console kept counting clicks from Google throughout, since it does not rely on code in your pages. Hosting accounts often keep their own statistics from the server's logs, which count differently but show the shape of the traffic.

Enquiries sit in the inbox and orders in the store; a note of those beside the annotation helps whoever compares later.

The counter-case

A site that rarely changes, with its code added somewhere updates do not touch, can go years without a problem. For it, the alert and an occasional test are enough.

A business that seldom reads its analytics loses little to a gap at first. The cost arrives later, usually at a bad moment: during a redesign, an argument about advertising, or the sale of the business.

For every site that changes, though, test with the real-time report after each change, alert for silence, and annotate any gap.

After every change

  1. Open the real-time report on a computer.
  2. Visit from your phone on mobile data.
  3. Check a landing page and the blog too.
  4. Confirm each visit counts once, not twice.
  5. Annotate the change on its date.
  6. Set a custom alert for a silent day.
  7. Move the code out of theme files.

Step two is the one to remember. It takes a minute, needs no technical knowledge, and catches missing code the same day instead of five weeks later.

Once the counting works, making it count the right things is covered in goals in analytics that nobody set up.


Frequently asked questions

Why did my analytics suddenly drop to almost nothing?

Usually because a change to the site removed the tracking code: a new theme, a theme update, a plugin change, a redesign, or an edit in Tag Manager.

Can the missing data be recovered?

No. Analytics only records visits while the code is on the page. Search Console, server statistics, enquiries and orders can show whether the business itself changed.

How do I test that tracking works?

Open the real-time report on a computer and visit the site from your phone on mobile data. The visit should appear within seconds, with the page you are on.

Why use mobile data for the test?

Because view filters apply to the real-time report too. If your office's internet address is filtered out, a test visit from the office Wi-Fi will never appear.

What is an annotation for?

It is a dated note on the Analytics graphs. Marking the day tracking stopped and the day it resumed explains the gap to anybody reading the reports later.

How can I find out sooner next time?

Set a custom alert for sessions falling below your quietest normal day. If tracking stops, the email arrives the next morning instead of next month.

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.

Redesign or theme change this year?

Send us view access to your Analytics. We will check the code on every template and set the alert.

Start a Conversation