How to Track Outbound Link Clicks
Measure clicks to external sites — affiliates, socials, partner links — with a tiny event listener and read the report that actually matters.
The moment a visitor clicks to another site, classic analytics goes blind — yet for many pages that exit click is the whole point: the affiliate link, the GitHub repo, the App Store button, the partner referral. Tracking outbound clicks turns your most important conversions from invisible to countable, and it takes one event listener.
The implementation
document.addEventListener('click', (e) => {
const a = e.target.closest('a');
if (!a || !a.host || a.host === location.host) return;
window.webanalytics?.track('outbound_click', {
href: a.href,
text: (a.textContent || '').trim().slice(0, 80),
page: location.pathname,
});
});Notes that save debugging: closest('a') catches clicks on icons inside links; the host comparison treats subdomains as outbound (adjust if you prefer); and no preventDefault/redirect dance is needed — the event posts asynchronously while the browser navigates.
Reading the report
- Per destination: group by href domain. If your 'as featured in' links outperform your pricing CTA, the page hierarchy is arguing with reality.
- Per page: which content actually sends people to the affiliate/store/repo? Pair with traffic to compute click-through rate per page — the honest version of 'top content'.
- Per source: because the visitor record carries first-touch attribution, you can see which campaigns deliver visitors who click through versus visitors who merely arrive.
Special cases
- Affiliate links via redirectors (/go/product-x): the listener above sees the internal href — fine, the slug identifies the product. Track these as their own event name if affiliates are your business.
- target=_blank links need nothing special; the page survives, the event sends normally.
- Store buttons: for app landing pages, outbound store taps are the conversion — the dedicated guide builds the full funnel around them.
Clycyo captures clicks automatically at the page level; the explicit event above adds the destination and intent layer that turns clicks into a conversion report. Ten minutes of setup, and the question 'does anyone actually click that?' retires permanently. The same listener pattern handles file downloads — most sites ship both together.