UTMCPdocs
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 — naming the campaign if utm_id is on the URL, and otherwise sending the page's own address, which UTMCAP matches against the landing pages it knows.
  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, and what stops the button being dead for a visitor who arrived from search.

#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. 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.

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. It matters 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.

The URL still wins wherever it names a campaign, because it is written per click and a page can be reused. So the campaign tag is a floor, not an override.

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 {click_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.

#What it exposes

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

window.utmcap.version       // '5'
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' });

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 organic arrival with no utm_id
4 Fills that placeholder only where a redirect brought the visitor
5 Accepts &c=<alias> on its own src