Lesson 9 of 15
Outbound Links & Downloads
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
Two of the most-asked-for click reports, outbound links and file downloads, both come from the same Just Links trigger. What tells them apart is the Click URL variable: where the link points.
You'll build link triggers and use Click URL conditions to separate links leaving your site from links to files like PDFs and ZIPs.
Goal
Tell outbound links and file downloads apart with Click URL conditions on a Just-Links trigger.
Build it in GTM
Enable the Click URL variable
- Go to Variables in the left sidebar and click Configure at the top of the Built-In Variables section.
- Switch on
Click URL. It holds where the clicked link points, which is how you tell outbound links from downloads.
Outbound trigger
- Go to Triggers → New and choose Click → Just Links.
- Set it to Some Link Clicks so a condition appears.
- Set the condition to
Click URLdoes not contain your own hostname, e.g.thehappytagger.com. - Name it
Link - Outboundand Save.
Download trigger
- Go to Triggers → New again and choose Click → Just Links, set to Some Link Clicks.
- Set the condition to
Click URLmatches RegEx\.(pdf|zip|docx|xlsx)$. - Name it
Link - Downloadand Save.
Tag: Custom HTML - Test
- Go to Tags → New and choose Custom HTML with
<script></script>(fires but does nothing). Name itCustom HTML - Test. - Under Triggering, add both
Link - OutboundandLink - Download(or make one tag per trigger). - Leave Wait for Tags off, navigation is prevented here, and Save.
- Go to Tags → New and choose Custom HTML with
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
Link Click event. The outbound links fire your outbound tag; the .pdf and .zip links fire your download tag, split by the Click URL conditions you set.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded