Outbound links Pro

Capture clicks on any anchor that points to a different hostname. Useful for measuring traffic you send to other domains: affiliate links, social share buttons, links out to your GitHub, npm, or documentation on a separate subdomain.

Enable

init
init("proj_xxx", { extensions: { outboundLinks: true } })

// or, in React:
<Analytics projectId="proj_xxx" extensions={{ outboundLinks: true }} />

What fires

One outbound_click event per matched click, with three properties:

PropertyExampleNotes
urlhttps://github.com/clamp-sh/clampFull resolved URL, including path and query.
hostgithub.comHostname only. Use this to group by destination.
pathname/clamp-sh/clampPath portion of the destination URL.

What counts as outbound

How it works

A single delegated click listener is attached to document in the capture phase, so it runs before any stopPropagation further down the tree. On click, the SDK walks up the DOM from the target using closest("a"). One listener per page regardless of how many links exist — cheap.

Gotchas