Consider a website with these three pages:

<!-- example.com/shirts -->
<a href="amazon.com/red-shirt">
<a href="amazon.com/blue-shirt">
<a href="amazon.com/fabric-cleaner">

<!-- example.com/pants -->
<a href="amazon.com/black-pants">
<a href="amazon.com/gray-pants">
<a href="amazon.com/fabric-cleaner">

<!-- example.com/socks -->
<a href="amazon.com/tube-socks">
<a href="amazon.com/crew-socks">
<a href="amazon.com/fabric-cleaner">

Each page contains some Amazon links. Some of the Amazon links appear on multiple pages, while others appear on only a single page.

How can I set up Google Tag Manager and/or Google Analytics in such a way that I can see how often each link was clicked on a per-page basis?

My end goal is to be able to compile a report in this format:

    Amazon links were clicked a total of 167 times
    amazon.com/red-shirt was clicked 63 times
    amazon.com/blue-shirt was clicked 92 times
    amazon.com/fabric-cleaner was clicked 12 times

    Amazon links were clicked a total of 101 times
    amazon.com/black-pants was clicked 51 times
    amazon.com/gray-pants was clicked 39 times
    amazon.com/fabric-cleaner was clicked 11 times

    Amazon links were clicked a total of 111 times
    amazon.com/tube-socks was clicked 38 times
    amazon.com/crew-socks was clicked 39 times
    amazon.com/fabric-cleaner was clicked 34 times

And also a report in this format:

    63 total clicks
    63 clicks on example.com/shirts

    92 total clicks
    92 clicks on example.com/shirts

    51 total clicks
    51 clicks on example.com/shirts

    39 total clicks
    39 clicks on example.com/shirts

    38 total clicks
    38 clicks on example.com/shirts

    39 total clicks
    39 clicks on example.com/shirts

    57 total clicks
    12 clicks on example.com/shirts
    11 clicks on example.com/pants
    34 clicks on example.com/socks

I've set up some Variables and Events to the point where I can see how many total Amazon links are being clicked on my site and how many clicks happen on each page, but I can't figure out how to break them down by link.

  • I would use Google Data Studio to create the reports. It will give you more flexibility and options than GA, with how you want to break it down and display the data
    – Bronwyn V
    Commented Dec 19, 2019 at 11:53

1 Answer 1


There's a few options for this.

You can write a custom JavaScript function that sends this data to Google Analytics as event data. You can capture the ID or URL of the link and send that as an event value.


You can also do the same thing through Google Tag Manager.


A third-party tracking application can track which links are clicked where. For example, HotJar will track any click on any page and produce a heatmap for you showing which links people click. If you have more than a couple of pages with a couple of links, this is probably the most useful option. There's quite a few different applications which do similar things, you'll often get a free option which will track the first few hundred users and then have an option to pay for more data.

Here's a list of similar services, you can find one that suits. https://www.g2.com/products/hotjar/competitors/alternatives

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.