How to setup Matomo for site using PHP include and JS?

I have static site where user can load additional content. Content is loaded by

<a href="#" onclick="load(&#39;sample.php&#39;,&#39;samplediv&#39;);return false;">

where load uses document.getElementById(target).innerHTML, window.XMLHttpRequest,

and some parts of site are loaded by PHP include(“sample.php”);

I’ve added Matomo script to main site however I can’t see under ‘Actions’ pages/content loaded by user


If your website is a Single Page Application (so you are using JavaScript instead of regular links for page changes) Matomo can’t automatically detect when you are changing the page.

To fix this you need to call _paq.push(['trackPageView']); whenever Matomo should track a new page (after setting the new URL and Title)