Skip to content

Outbound links

Outbound tracking is on by default. Every click anywhere on the page is inspected; if it lands inside an <a> whose hostname differs from location.hostname, one hit of type outbound is sent.

<a href="https://github.com/acme/sdk">Our SDK</a>
  1. The listener is registered on document in the capture phase, so it runs before your own handlers and before a framework can call preventDefault().
  2. event.target.closest("a") finds the link — a click on an icon or a <span> inside the anchor still counts.
  3. The href is parsed. A URL that will not parse is ignored.
  4. new URL(href).hostname === location.hostname → ignored.

That last comparison is an exact hostname match. Consequences worth knowing:

Link From acme.com Recorded?
https://github.com/x Yes
https://www.acme.com/x acme.com Yes — different hostname
https://docs.acme.com/x acme.com Yes — subdomains are separate hosts
/pricing No
mailto:hi@acme.com Yes, hostname is empty and differs
tel:+1… Yes
#section No
javascript:void(0) No — does not parse to a different host

The full destination URL is stored as the event name, so the Events screen can show both the exact link and the host it points at.

{ "t": "outbound", "n": "https://github.com/acme/sdk", "u": "https://acme.com/" }

The hit is sent with navigator.sendBeacon where available, because the page is usually about to unload. A beacon cannot read a response, so it is never held waiting for the identity probe — it goes as it stands.

On Events, the Links & revenue tab appears as soon as at least one non-custom event exists. It has two panels:

  • Destination hosts — one row per host, with visitors and clicks. The host is cut back out of the stored URL server-side, so visitor counts are not summed across URLs and double counted.
  • Links — one row per exact URL, with clicks and visitors, up to 25.

Clicking a link row sets event=<full href> and opens that URL as the selected event, which gives it a time series, a summary and breakdowns like any other event.

Outbound events also appear:

  • In the Sessions drawer timeline, with the destination.
  • In the Events count of a visit (the events column counts every non-pageview hit).
  • As a possible goal target — a goal matching an event name matches custom, outbound and revenue types, so you can name a specific outbound URL as a conversion.
  • As a node in Journeys when Custom events is on.
<script defer
data-site="pk_live_xxxxxxxx"
data-outbound="false"
src="https://ingest.tracing.tools/t.js"></script>

Only the literal string "false" disables it.

Reasons to: a documentation site whose every page is mostly external links, or a plan where the extra volume is not worth the quota. Outbound hits count towards your monthly event allowance like any other event.

If you have disabled automatic tracking but still want specific links counted, send a custom event:

<a href="https://partner.example" data-tracing-event="partner_click"
data-tracing-event-partner="example">Partner</a>

That records a custom event rather than an outbound one, so it lands in the main event list instead of the links panel.