docs
Open the app →

The tag

One line of HTML on your pages. What it reads on arrival, what it remembers, and the two snippets the app offers you.

<script src="https://app.utmcap.com/t.js?k=YOUR_SITE_KEY" async></script>

Put it on every page of your site, not only the landing page. It is a few kilobytes, cached hard, and loads without blocking anything.

The key on its own src is what makes it self-configuring: one line of HTML carries both where to report and who is reporting, so there is nothing to keep in step with a second snippet.

#What it does on arrival

In order:

  1. Looks for a click id on the URL — cid, click_id, clickid or _cid. A redirect puts one there.
  2. Failing that, reads its own cookie, _utmcap_cid.
  3. Failing that, opens the visit itself by posting to /api/v1/visit — but only if something names the campaign: utm_id on the URL, or &c=<alias> on the tag's own src.
  4. Rewrites the call to action so pressing it records the click-out and reaches your offer.

Step 3 is what makes a campaign work on a platform that will not redirect.

If nothing names a campaign, the tag does nothing and the button stays inert. It does not guess: UTMCAP used to match the page's own address against the landing pages it knew, and that mixed a campaign's bought clicks with everyone else who happened to reach its lander. A page whose visitors should belong to a campaign now says so — see the campaign tag below.

the tag looks for a click id, in this order1 · on the URLcid, utmcap_id, click_id, clickid or _cid — aredirect put one there2 · in its own cookie_utmcap_cid, from an earlier page of this visit3 · open the visit itselfposts to /api/v1/visit — only if utm_id or &c=names a campaignnot therenot thereThis visitor’s click idwhichever of the three answered,everything after it is the samefoundfoundopenedThe button becomes /out/<id>
What the tag does the moment a page loads: three ways to find this visitor’s click id, tried in order, and the same ending whichever one answers.

#The two snippets

The Tracking tab of a zero-redirection campaign offers two, because there are two situations and they need different answers.

The universal tag is the one above. It names no campaign, so every visitor is attributed by the utm_id on their own URL — and a visitor arriving without one is not recorded at all. Use it on a page more than one campaign sends traffic to: utm_id is the only thing that can tell two campaigns apart on the same address, so it is the only thing that should decide.

The campaign tag adds the campaign's alias:

<script src="https://app.utmcap.com/t.js?k=YOUR_SITE_KEY&c=CAMPAIGN_ALIAS" async></script>

Use it on a page only one campaign uses, and where you want that page's own visitors — the ones who found it in search, from a bookmark, from a link somebody shared — to belong to that campaign. The page is declaring which campaign it is part of, which is something only you can know.

It also catches paid traffic whose utm_id went missing, because utm_id travels on the URL and a URL can lose it: the plain landing page address pasted into the ad platform instead of the generated Final URL, or a Final URL edited afterwards. Baked into the page, the alias cannot be lost that way, so the button still works and what the visitor does next still lands on the campaign.

The campaign tag attributes, it does not bill. A visit costs money only where the URL named the campaign, because that is the arrival a platform charged you for. A visit named only by the tag records with no traffic source and zero cost — see an organic click is not a paid click. So a Final URL that lost its utm_id is recorded and routed, but its spend is missing, and the orphan count on the Tracking tab is what tells you to fix the ad.

The URL still wins wherever it names a campaign, because it is written per click and a page can be reused.

Do not put the campaign tag on a shared page. One page carries one tag, so it can name only one campaign — every visitor arriving there without utm_id would be attributed to that one.

#What it remembers

Two cookies, both first-party on your own domain:

Cookie Holds
_utmcap_cid This visitor's click id, so pages after the first still belong to the same click
_utmcap_src Whether a redirect brought them, which decides whether a pasted {utmcap_id} is filled

A visitor who blocks cookies still works: the click id lives on the page for as long as that page is open, and the server refuses to open a second click for the same visitor within thirty minutes. If they return inside that window with no cookie at all — a private window, a cleared browser — the server hands back the id it already issued rather than nothing, so the button still works and no second click is counted.

#WhatsApp and phone leads

A site that sells by talking to people loses the lead at the moment it arrives: tapping a number opens the dialler, tapping a WhatsApp button leaves for WhatsApp, and nothing comes back to say it happened.

The tag catches both by itself. You add nothing to the page.

It looks for these, anywhere on the page, including buttons added after it loads:

Link Fires
tel:+919876543210 Phone click
https://wa.me/919876543210 WhatsApp click
https://api.whatsapp.com/send?phone=… WhatsApp click
whatsapp://send?phone=… WhatsApp click

Both goals come from Add common goals on the measurement page. If they are not on your site yet, press it once.

A link that merely mentions wa.me somewhere in a query parameter is left alone — the match is on the host, so a page that links to somebody else's WhatsApp link does not invent a lead.

#Only traffic you paid for

A press is recorded only when the visitor has a click id — that is, they arrived through a tracked link, or the page declares its campaign with &c=.

Somebody who found your page by themselves and tapped WhatsApp is not recorded. That is deliberate: this is a tracker for traffic you bought, and the same rule applies to a shop's own orders. If you want every WhatsApp tap counted, organic included, that is a web analytics question and this is the wrong tool for it.

Nothing on the page says so — so if you are testing and see no goal, check that you opened the page through a campaign URL rather than by typing the address.

#A press is not a lead

Read these as intent, not as leads, and keep them separate from whatever you count as a lead.

The visitor lands in WhatsApp and may never type. A phone tap can be cancelled, and on iOS it is recorded before the confirm box appears. So the count runs ahead of real leads — commonly two to five times ahead. If you buy on cost per lead and read these as leads, every campaign will look cheaper than it is.

There is also one thing no browser can see: a visitor on a desktop who reads your number and dials it from their phone. Nothing of ours is involved, so nothing is recorded.

#The reference in the message

So that a real conversation can be tied back to the ad click that paid for it, the tag puts the click id into the WhatsApp message the visitor is about to send:

Hi, I am interested

Ref: 7SrrAb7DPM

It arrives in your inbox with the message. This is the one signal that survives the visitor switching devices — they may tap on your site on a laptop and send from the WhatsApp app on their phone, where no cookie of ours exists.

Set text= on your own link and the reference is added after your words. A link with no text= gets the reference by itself, which is plain but keeps the feature working on floating widgets, which usually prefill nothing.

Two things worth knowing:

  • The visitor can see the reference and can delete it. Confirming the lead automatically would need the WhatsApp Business API; today you match it by hand, or your CRM sends a postback.
  • A visitor who arrived with no campaign — nothing naming utm_id or &c= — has no click id, so nothing is recorded at all. See below.

To turn it off on one link, add data-utmcap-noref:

<a href="https://wa.me/919876543210?text=Hi" data-utmcap-noref>Chat</a>

#What it exposes

The tag leaves an object on the page so your own code can read it or report events.

window.utmcap.version       // '9'
window.utmcap.clickId       // this visitor's id, or null
window.utmcap.fromRedirect  // did a redirect bring them?
window.utmcap.tagCampaign   // the campaign this page declares, if any

window.utmcap.track('signup');
window.utmcap.goal('purchase', { value: 49.9, order: 'A-1' });

// How many WhatsApp and phone links the tag can see. Useful when the
// answer should not be 0.
window.utmcap.leads();

goal is how a conversion is reported from the page itself, for anything you sell directly. Where a network pays you, the conversion arrives by postback instead and you do not call this.

#Versions

The tag reports its own version because it is cached, and a fix that is live on the server but not yet in a visitor's browser looks exactly like a fix that does not work. If you have just changed something and the behaviour has not, check window.utmcap.version before looking anywhere else.

Version Change
3 Fills a pasted {click_id}; opens a visit for an arrival with no utm_id, matched by the page's address
4 Fills that placeholder only where a redirect brought the visitor
5 Accepts &c=<alias> on its own src
6 Fills a pasted {utmcap_id} as it fills {click_id}, and reads utmcap_id from the page address
7 Fills the call to action on a campaign that cannot redirect, which until then answered 404 on every press
8 Opens a visit only where utm_id or &c= names a campaign — no more matching by page address — and reports which of the two named it, so a declared page is not billed as a click
9 Finds WhatsApp and phone links by itself, and puts the click id into the WhatsApp message so a conversation can be matched back to the click

Tracking tips by email

Practical tips on tracking, attribution and ad costs, from the people who build UTMCAP.

Unsubscribe any time. Privacy policy