Track
Outbound links and downloads
Clicks on links to other sites and on file downloads are tracked automatically, and the Exit link tab shows where visitors leave to.
The script records two events on its own, with the clicked link's full URL in the url prop. Both count toward your monthly events like any custom event.
| Event name | Recorded when |
|---|---|
Outbound Link | A click on a link whose hostname differs from the current page's hostname |
File Download | A click on a link whose path ends in .pdf, .zip, .csv, .xlsx, .docx, .dmg, .exe or .apk (any case), on any hostname |
A download link on another site is recorded once, as File Download. Links without a hostname, such as mailto: and tel:, are not recorded.
How clicks are detected
One click listener on the window, in the capture phase, looks for the nearest a[href] around the click target. Clicks on an icon or text inside a link count, and so do clicks that open a new tab or window: Ctrl, Cmd or Shift clicks, links with target="_blank" and middle clicks. Right clicks are not recorded. Navigation done from script without a link element is not recorded.
The listener never calls preventDefault and never waits, so leaving your site is not slowed down. When the click leaves the current tab, the event goes out with the page's exit beacon (navigator.sendBeacon).
See where visitors leave to
The overview's Pages card has an Exit link tab: destinations ranked by the visitors who clicked them, with the click count in the tooltip. The destination is grouped without its query string or fragment, so github.com/acme?ref=pricing and github.com/acme#readme count as one row and tokens in links never reach the report. The full URL stays in the event's url prop on the Events page for 90 days.
Filter by page to see where visitors leave from one page: open the Page tab, click the page, then open Exit link. The report keeps every day of history.
Turn it off
<script defer data-site="SITE_ID" data-outbound="false" src="https://api.productlense.app/a.js"></script>Use them as goals
Create a goal on the event name Outbound Link or File Download to count conversions such as "downloaded the whitepaper". See Goals and funnels.