Best practice Tag manager and high traffic site: individual tags or content tracking?

We (a non profit) are tracking about 75-100 million visits a year on a dedicated server (8CPU 32 GB) (and another one for testing). I have been using Tag manager for a while now. Everthing was working like a charm until yesterday when I needed to analyze on page user interaction: on page anchor menu clicks and scroll reach. This could only be done by triggering 1 to 4 new tags per page / every page (on top of what we already had: two data layers which are being used by custom dimensions and the occasional event tracker). All in all it meant A LOT more entries in the visitors logs. The data (events) was being used in maybe 6 custom reports (we are using a cron job of course)

This clearly was too much for our poor server. The main website wasn’t affected and was still being tracked (as far as I can tell now, not entirely sure if all visits have been recorded though) but a smaller satellite website was not being tracked anymore because the tracking script wasn’t loaded within the set time limit. Furthermore the Matomo UI became pretty much inaccessible / nonresponive.

I am scratching my head here, was this to be expected? Was I being naive? I did expect it to put a strain on the server but it went from smooth as a whistle to being at death’s door very fast! What would be best practice in this case? Should I have never done it this way? We do have a bunch of premium plugin like heatmaps. I couldn’t really use that one because I needed an overall indication, and heat, scroll and clickmaps are being used on specific pages.

Or is there nothing wrong with this method and is it just a matter of server resources?

Not a clear question really I know but I value your opinions so whatever comes to mind…:slight_smile:

I was just reading up on this.

My main question: would this method be better performance wise compared to creating tags like described above?

Edit: I found @RonanChardonneau 's youtube vid (I always watch them) and tried this method.

Ps Ronan, reason the interaction didn’t work was because you need to push trackContentInteraction as well I think

<script>
var el - document.querySelector(".new-matomo-banner");
el.dataset.trackContent=""
el.dataset.contentName="theName"
el.dataset.contentPiece="Something"
_paq.push(['trackVisibleContentImpressions']);
_paq.push(['trackContentInteraction']);
</script>

I got this working perfectly fine! Now I want to use it for menu-items. But all menu-items. It only adds the code to the first one though. Can anyone help me with the script?

var el - document.querySelector(".menu-item");

And how do I get the name from the click text?

el.dataset.contentPiece="Something"

Ps Are wouldn’t it be useful to include this in the ui as well

_paq.push(['trackContentInteraction']);

Hi Japhy,
Thank you so much for your kind message, almost no one say anything about my video tutorials so it is like screaming in the desert.
Regarding your questions, most of my video tutorials are proof of concepts, I hardly ever dig much, I am just showing that it is possible, so to say I am doing the first step.
This video I made was about answering to the frustration that the people I am training have. My clients are mostly end users, so they cannot access to the source code and can only play with the tag manager. So when I talk to them about the possibility of the content tracking, they don’t understand it because they cannot experience it. So, this video was about this issue.
I would personally not recommend the technique of using javascript in order to change elements on the page for performances issues, even if I cannot prove you scientifically with some tools that there is a difference of loading time for example.
One can add that my technique has a lot of chances to break if the template of your pages are subject to changes.
Hope that helps,

Hi Ronan,

Well your videos always inspire me to experiment with MTM and it got me started with Tag Manager in the first place. It always surprises me not more people are searching the web, creating content, asking questions etc on MTM. It’s not like no one is using it, some of the largest non profit and gov websites here in the Netherlands are using it.

As for the javascript, I was playing around with it on my personal website. When implementing on our organisation website I was thinking about asking the devs to put it (content piece name etc) in the code. There is no way they will approve (and they should not approve either!) of me injecting my own js in the site anyway haha. It’s safer and it should be faster as well. Just wondering if all the extra data will cause our Matomo server to become sluggish again. Well only one why to find out I guess.