TechBill
(Bill)
January 24, 2018, 4:52pm
#1
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
melbao
January 25, 2018, 5:28pm
#2
I had the same problem. Content tracking does not work for that.
Use Internal Link Tracking. Tutorial:
TechBill
(Bill)
January 25, 2018, 6:30pm
#3
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
melbao
January 25, 2018, 7:03pm
#4
The “content tracking” is more intended for visits. But you do not just want to see how many times the banner has been seen.
Lukas
(Lukas Winkler)
January 25, 2018, 7:06pm
#5
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:
https://matomo.org/docs/content-tracking/
I can’t help much more, but maybe the extended developer documentation is useful:
https://developer.matomo.org/guides/content-tracking
melbao
January 25, 2018, 7:36pm
#6
Yes, theoretically. But it is not suitable for pure click tracking.
opened 02:28PM - 15 Jan 18 UTC
Hello, I want to track internal link clicks, but not the contents visit. I used … "trackContentInteractionNode", but it does not show any data under "Contents".
Here are some tests. Please check yourself and make a judgment.
1#######################################################
```
<div>
<a id="testclick" class="piwikTrackContent piwikContentPiece" href="/test/click/">
<img class="" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 12:42:16
https://www.example.com/test/click/
Content Name: Unknown
Content Piece: Unknown
Content Target: https://www.example.com/test/click/
Content Interaction: Unknown" value="11">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
Unknown -
Unknown
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
2#######################################################
```
<div>
<a href="/test/click/">
<img id="testclick" class="piwikTrackContent piwikContentPiece" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 12:52:06
https://www.example.com/test/click/
Content Name: /test/click/PICT1234.JPG
Content Piece: https://www.example.com/test/click/PICT1234.JPG
Content Interaction: Unknown" value="14">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
/test/click/PICT1234.JPG -
https://www.example.com/test/click/PICT1234.JPG
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
3#######################################################
```
<div>
<a class="piwikTrackContent piwikContentPiece" href="/test/click/">
<img class="" id="testclick" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 12:38:33
https://www.example.com/test/click/
Content Name: Unknown
Content Piece: Unknown
Content Target: https://www.example.com/test/click/
Content Interaction: Unknown" value="8" id="ui-id-1">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
Unknown -
Unknown
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
4#######################################################
```
<div>
<a id="testclick" href="/test/click/">
<img class="piwikTrackContent piwikContentPiece" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
(not tracked)
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
5#######################################################
```
<div>
<a id="testclick" class="piwikTrackContent" href="/test/click/">
<img class="piwikContentPiece" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 13:11:22
https://www.example.com/test/click/
Content Name: /test/click/PICT1234.JPG
Content Piece: https://www.example.com/test/click/PICT1234.JPG
Content Target: https://www.example.com/test/click/
Content Interaction: Unknown" value="25">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
/test/click/PICT1234.JPG -
https://www.example.com/test/click/PICT1234.JPG
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
6#######################################################
```
<div>
<a class="piwikTrackContent" href="/test/click/">
<img id="testclick" class="piwikContentPiece" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 12:28:48
https://www.example.com/test/click/
Content Name: /tst/click/PICT1234.JPG
Content Piece: https://www.example.com/test/click/PICT1234.JPG
Content Target: https://www.example.com/test/click/
Content Interaction: Unknown" value="4" id="ui-id-1">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
/tst/click/PICT1234.JPG -
https://www.example.com/test/click/PICT1234.JPG
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
7#######################################################
```
<div>
<a id="testclick" class="piwikContentPiece" href="/test/click/">
<img class="piwikTrackContent" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
(not tracked)
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
8#######################################################
```
<div>
<a class="piwikContentPiece" href="/test/click/">
<img id="testclick" class="piwikTrackContent" src="/test/click/PICT1234.JPG" alt="" width="200" height="150">
</a>
</div>
---
document.getElementById("testclick").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
---
<li class="content" title="Jan 15, 2018 13:18:11
https://www.example.com/test/click/
Content Name: /test/click/PICT1234.JPG
Content Piece: https://www.example.com/test/click/PICT1234.JPG
Content Interaction: Unknown" value="30">
<div>
<span class="icon-document action-list-action-icon" title="Content Interaction"></span>
[Unknown]
/test/click/PICT1234.JPG -
https://www.example.com/test/click/PICT1234.JPG
</div>
</li>
---
Actions
- Contents
-- Content Name "There is no data for this report."
-- Content Piece "There is no data for this report."
```
#######################################################
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>
opened 01:18PM - 15 Jan 18 UTC
closed 09:33AM - 08 Feb 22 UTC
answered
Hello, I just want to count clicks on an internal link. This works with "trackCo… ntentInteractionNode". But there are problems.
If the Matomo script with "trackContentInteractionNode" is in the `<head>`, Matomo will not work because there is an "is not defined" message.
```
document.getElementById("aid").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
```
The element "document.getElementById("aid")" does not exist when the Matomo script is loaded with "trackContentInteractionNode" in the <head> in the browser (Firefox 57.0.4).
For "trackContentInteractionNode" the Matomo script must be at the bottom of the <body>. But then the Matomo script does not work either, because at least one <script> element must already exist in the head because of the "insertbefore". There is no "if </script>" in head check" in the Matomo Script. If no "</script>" is in the <head>, then a document.getElementsByTagName("head")[0] .appendChild must be used.
TechBill
(Bill)
January 25, 2018, 8:58pm
#7
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
TechBill
(Bill)
January 25, 2018, 9:07pm
#8
To keep track of banners click, i add this in href
onclick=“javascript:_paq.push([‘trackEvent’, ‘Clicks’, ‘Banners’, ‘NameofBannerHere’]);”
correct?
Thank you
TechBill
(Bill)
January 26, 2018, 3:05pm
#9
TechBill:
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
melbao
January 27, 2018, 4:30pm
#10
Fine. Please mark it as solution.