Tracking banner clicks

I read the guide about tracking contents several times and I tried tracking a couple of banners on my websites but it still not listing it on my Matomo in contents

Here what I have in my head

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  _paq.push(['trackVisibleContentImpressions']);
  (function() {
    var u="//data.findmall.com/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '1']);
    _paq.push(['trackVisibleContentImpressions']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

And one of my banner

<p align="center"><a href="http://www.minelab.com/anz/accessories-1/pro-find-35?utm_source=Findmall&utm_medium=Banner&utm_campaign=Findmall%20Home%20page%20Nov%2017" data-track-content data-content-name="Minelab Pro-Find" data-content-piece="Banner"><img border="0" src="https://www.findmall.com/images/ml_banner1.gif" ></a>

What am I doing wrong?

Thank you
Bill

I had the same problem. Content tracking does not work for that.
Use Internal Link Tracking. Tutorial:

It start working last night but it showing that my banner had over 2,500 hits which I think it couldn’t be right. Maybe 100-150 a day sound right but 2,500,I doubt it.

I will try the tutorial you linked and see if it work better than one I had set.

Bill

The “content tracking” is more intended for visits. But you do not just want to see how many times the banner has been seen.

I have to disagree. Tracking how often a ad banner was seen and clicked is the core usecase of the content tracking feature as it can be seen in the documentation:

I can’t help much more, but maybe the extended developer documentation is useful:
https://developer.matomo.org/guides/content-tracking

Yes, theoretically. But it is not suitable for pure click tracking.

Or I misunderstood the question.
If you want to track how many times the banner has been viewed, and how many times it has been clicked, content tracking is the way to go.

The “content tracking” codes do not put into the Matomo code, but usually at the very end of the web page document, since the HTML elements that need to be tracked already need to be present for them to be tracked. If the code is at the top and the item below, then it will not be found because it does not exist yet. logical?
Use the Browsers “Developer Tools” console to see JS warnings and errors.

at the bottom of the page:

<script>
  _paq.push (['track impressions visible content']);
</script>
</body>
</html>

I only wanted to track how many time the banner been clicked.

I will read up on the tutorial and use internal link click method instead. I think it something what I needed on my webpage.

Bill

To keep track of banners click, i add this in href

onclick=“javascript:_paq.push([‘trackEvent’, ‘Clicks’, ‘Banners’, ‘NameofBannerHere’]);”

correct?

Thank you

Yup that work the way I wanted it to. But I think I need to switch the Clicks and Banners around

Banners for Categories and Click for Action

Fine. Please mark it as solution.