Integrating matomo into php page

Have a small html site with matomo already well integrated. No problems. But, I’ve a simple one page php blog that takes a post and dynamically generates a new index.html each time. I’ve tried to paste the script into the php index.html generation page at different places within html area but it only returns a blank page. After a while figured it was a cross language issue.

I’m assuming it is as simple as maybe installing some dependencies, a tweak on php.ini and then inserting the php tracker into html portion of generation page to not result in blank page? Would matomo still collate results? Is there simple straight forward tutorial to walk me through process?


Is your blog like a single page application?
If yes, have a look at:

It is a “single page” application, but… The link provided doesn’t seem pertinent as dynamic frameworks aren’t used. The basic page html layout remains same. The only new content is within body

section from .txt file. Also I’d mention, while I’m no php or coding expert, the code in and of itself looks a little haphazard with some elements seeming out of place or missing its twin in some random places.

Bump. Just trying to insert tracking code in page somewhere that works!..

Hi @maqueen !
As per my understanding, you have an HTML page, the content in the body of this page gets changed dynamically but header & footer section of this HTML page is static. So, please add the javascript tracking code in either header or footer section of the page and this page should be tracked in Matomo.

If this is not the case, and a complete page with dynamic name is generate each time, then you should use PHP tracker instead of javascript, because PHP is a server side language so I don’t think it will execute client side langue i.e. javascript tracking code.
I am not that expert as @heurteph-ei so my apologies if I said something wrong :slight_smile: