data-outbound sends an Outbound link event and data-downloads sends a File download event, both with the link’s address in the url property. Both are off until you add the attribute, and neither needs any change to your links.
Turn the modules on
1
Add the attributes to the script tag
Add
data-outbound, data-downloads or both to your existing tag, as above. They are flags: the attribute’s presence turns the module on. Use d.js, the default script: the smaller d.core.js build leaves these modules out and ignores the attributes.2
Click a link on your live site
Click a link to another website, or a link to a PDF.
3
Find the events in the dashboard
Open Events.
Outbound link and File download appear next to your own custom events. Select one, then select the url property to see which links were clicked.Outbound links
Withdata-outbound, a click on a link sends:
A click counts when the link uses
http: or https: and points to a different host than the current page. The host includes the port and the subdomain, so a link from www.example.com to docs.example.com is outbound. Links to mailto:, tel: and other schemes are not tracked.
Clicks anywhere inside the <a> element count, and so do middle clicks, which open the link in a new tab. Opening a link from the right-click menu is not a click and is not counted.
File downloads
Withdata-downloads, a click on a link sends:
A click counts when the link has a
download attribute, or when its path ends in a known extension. The query string is ignored, and the match does not depend on case. Middle clicks count too. Links to files on other hosts count as well, so a click on an external PDF sends both Outbound link and File download when both modules are on.
The default extensions are:
download attribute to it:
What the url contains
Theurl prop is the link’s address, up to 500 characters, without its fragment. Its query string is cut in the browser the same way as the page URL: only the kept parameters stay, so signed or private query strings, such as presigned storage URLs, are not sent.
Next steps
Script attributes
Every attribute the script tag accepts, including the other optional modules.
Track 404 pages
Find broken links by recording visits to not-found pages.
Set up goals
Count a download or an outbound click as a conversion.