Troubleshooting

Two tags, one launcher, and the day it starts to matter

The loader checks for itself before doing anything and returns if it is already installed, so a duplicated tag produces one launcher rather than two. That is the safe behaviour and it is why this can sit unnoticed for months. It stops being harmless the day you change the key in one place and not the other.

The symptom

Nothing looks wrong, but a key change or an appearance change only takes effect sometimes, or not at all.

What it usually is

In rough order of how often each one turns out to be the answer. Work down rather than across: each carries a way to tell whether it is yours before you change anything.

  • 1

    The tag is in a theme template and in a tag manager

    Why
    Both are reasonable places to put it, and neither knows about the other. Whichever executes first wins, and the second is ignored.
    How to confirm it is this one
    View source and count occurrences of the loader URL. Two is the answer, and their positions tell you which two systems are involved.
    Fix
    Keep whichever one you will remember to maintain. A tag manager is easier to change and harder to notice; a template is the reverse.
  • 2

    The tag is in a layout that renders inside another layout

    Why
    Nested templates are the usual cause on a framework site: a base layout and a page layout that both include the footer partial.
    How to confirm it is this one
    Two occurrences in the source, adjacent or near-adjacent rather than in different regions of the document.
    Fix
    Move it to the outermost layout only. This is also the version that survives somebody adding a third layout later.
  • 3

    Two different keys are installed

    Why
    The install-once guard is about the loader, not about the key, so the first tag to run wins and the second assistant never loads. Two assistants on one page is not a supported arrangement.
    How to confirm it is this one
    Compare the data-key values on the two tags. If they differ, one assistant is silently doing nothing.
    Fix
    Decide which assistant should answer on this site and remove the other tag. If you genuinely need different assistants on different sections, install them on different pages rather than on the same one.

If none of those fit

After removing a duplicate, purge every cache in front of the page before checking. A duplicated tag is usually discovered during a change, and a cached copy of the old page will show you the old markup and send you back round the same loop.

Questions

Is a duplicate tag harmful?
Not to a visitor. It costs one extra request for a small file and produces one launcher. It is harmful to you, later, when a key rotation appears to have done nothing.
Which of the two wins?
The one that executes first, which is usually the one earlier in the document, but a tag manager can invert that. Do not rely on the order; remove one.
Can I run two assistants on one site?
On different pages, yes, by installing different keys in different templates. On the same page, no. The loader installs once per page and the second tag is ignored.

Keep reading

Try it on your own material

Upload a document or point it at your site, paste one line of HTML, then ask it something only your business could answer.