Unable to track on server but able to on local machine

I’m trying to set up Matomo for page view tracking using OctoberCMS. I have the Matomo URL, site ID, and token set and the tracker enabled in your plugin. However, Matomo only registers any activity (e.g. views) when I test it on my local machine and not when someone hits my website on the server. I have verified that the MatomoTracker.php file is accessible on the server such that

require_once $path;
MatomoTracker::$URL = 'http://matomo.my_domain.com/';

can be run without issue.

If it makes a difference, my Matomo installation and my website share a server. I checked the OctoberCMS logs and there is nothing related to my current issue. I only have debug mode on and no error is being thrown.

My JS snippet is:

    <!-- Matomo -->
    <script type="text/javascript">
        var _paq = window._paq = window._paq || [];
        /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
        (function() {
        var u="//matomo.philandersonphotography.com/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '1']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
    <!-- End Matomo Code -->


Needed an SSL certificate on matomo. Solved

1 Like