For a PDF brochure that is accessed through a banner link, how would one track the clicks on that banner using Google Analytics and Google Tag Manager?

I've been following this tutorial, and this one.

Because a PDF isn't a page that people land on, nor is it outbound, I need to do this a little differently than in the tutorials (which focus on tracking outbound link clicks).

I'm a noob with Tag Manager, so please include details, and don't hesitate to explain the obvious. Thanks.

  • The banner is on your site as opposed to advertising running on other sites? Commented Apr 2, 2021 at 9:21
  • @StephenOstermiller Yes, it's a banner linking to a PDF brochure on the same site. It's not outbound to some other site. (I didn't come up with the idea of doing it this way, nor did I author the PDF.) And if there's a better way to track clicks for this case than Analytics + TM, I'm open to other approaches too.
    – Mentalist
    Commented Apr 8, 2021 at 4:23

1 Answer 1

  1. Make a tag in GTM that sends your event to GA.
  2. Go to Variables. Click Configure for built-in vars.
  3. Select the Clicked Element like so: enter image description here
  4. Make a Click All Elements trigger.
  5. In the trigger config, Do something like this ( a[href*=".pdf"] ): enter image description here
  6. Now use the trigger for your tag.

It should work now. In addition, you can use CJS variables or other built-in variables or their combo to enrich your category, action and label there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.