<?php
function head(){
echo "
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//mystats.domain.com/„;
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '2']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
";
}
?>
—————————end of php——————————
Either I use „ or ‚ next to the echo command it fails:
Something went wrong
Unexpected error: syntax error, unexpected ‘_paq’ (T_STRING), expecting ‘;’ or ‘,’ in matomo.php on line 19
Please report error at https://discourse.theturninggate.net
so here I am
Has anyone managed to successfully integrate the code?
Somehow I am just spinning in circles. Other posts here in the forum have not brought me further
You need to use the phplugins-pangolin-sample.php file as a starting point. it’s found at /backlight/modules/custom-resources/phplugins/
There’s some code at the beginning of that file that’s necessary to make it all work. So just put your code below the section that reads: // SET USER FUNCTIONS BELOW (around line 227)
I had not specified the correct URL to get the tracking to run undisturbed.
The strange character at the end of the URL was created here in the forum when pasting the code into the post. So all good…
After about 24 hours the tracking just started to work as if by magic - as it is in IT.
I’m not sure if I should insert the backslashes at the URL. The code also seems to work with single quotes. So according to - never touch a running system - so I let it be this way.