Don't have one? Create one ↗
← All courses

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

  1. Enable the Click URL variable

    1. Go to Variables in the left sidebar and click Configure at the top of the Built-In Variables section.
    2. Switch on Click URL. It holds where the clicked link points, which is how you tell outbound links from downloads.
  2. Outbound trigger

    1. Go to Triggers → New and choose Click → Just Links.
    2. Set it to Some Link Clicks so a condition appears.
    3. Set the condition to Click URL does not contain your own hostname, e.g. thehappytagger.com.
    4. Name it Link - Outbound and Save.
  3. Download trigger

    1. Go to Triggers → New again and choose Click → Just Links, set to Some Link Clicks.
    2. Set the condition to Click URL matches RegEx \.(pdf|zip|docx|xlsx)$.
    3. Name it Link - Download and Save.
  4. Tag: Custom HTML - Test

    1. Go to Tags → New and choose Custom HTML with <script></script> (fires but does nothing). Name it Custom HTML - Test.
    2. Under Triggering, add both Link - Outbound and Link - Download (or make one tag per trigger).
    3. Leave Wait for Tags off, navigation is prevented here, and Save.

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.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

Each click adds a 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

0 of 15 lessons complete