• It would be very convenient if this WordPress plugin also ships the Matomo tracker proxy.
    Currently, the tracker proxy script files have to be manually placed into site root or
    some other server configuration used for making the tracker proxy available.
    Even better, if the plugin makes the tracker proxy configuration in WordPress available.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author braekling

    (@braekling)

    Hi @strarsis,

    the proxy script is already part of WP-Matomo. If you configure WP-Matomo to add the tracking code, you can choose “use proxy script”. This will change the tracking code to use the included proxy script.

    But it would worth a try to test it and also to compare it to the latest proxy script from Matomo, because I’m not using this myself and so I may miss some changes. Any feedback is appreciated!

    Thread Starter strarsis

    (@strarsis)

    @braekling: So I set up the WP-Matomo plugin to use the proxy script.
    However, the browser is unable to download the file /app/plugins/wp-piwik/proxy/matomo.js, which seems to be a proxy related JavaScript.

    Thread Starter strarsis

    (@strarsis)

    @braekling: Please help! Currently nothing is tracked at all with WP Matomo. ??

    Plugin Author braekling

    (@braekling)

    I wonder why the browser tries do download a file in /app/ instead of /wp-content/? And it should be matomo.php or piwik.php instead of matomo.js. Please check the generated tracking code.

    Thread Starter strarsis

    (@strarsis)

    @braekling:
    Injected tracker code:

    <!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['trackPageView']);
    _paq.push(['trackAllContentImpressions']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//www.example.com/app/plugins/wp-piwik/proxy/"
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '2']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->
    Thread Starter strarsis

    (@strarsis)

    @braekling: Any additional information I could provide to help you debug this issue?
    It would be great if the tracking proxy works properly so Matomo can finally track visitors.

    Plugin Author braekling

    (@braekling)

    Can you explain /app is used instead of your wp-content folder? Maybe this will help to understand what’s happening here.

    This is the code I get when I switch to proxy tracking:

    <!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//www.example.com/wp-content/plugins/wp-piwik/proxy/"
        _paq.push(['setTrackerUrl', u+'piwik.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.defer=true; g.src=u+'piwik.php'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->

    Just to be sure: Are you using the auto-generated code for proxy tracking or did you configure it manually?

    Thread Starter strarsis

    (@strarsis)

    @braekling: The plugin shows an autogenerated code and I haven’t changed it.
    The reason for why /app is used that a roots.io Bedrock WordPress installation is used that changes some paths.
    However, these paths are customizable in WordPress core and the issue probably results from using hardcoded paths instead the right WordPress constants and functions for retrieving the plugin, theme, uploads, etc. folder paths/URLs, see https://developer.www.ads-software.com/reference/functions/content_url/.

    • This reply was modified 5 years ago by strarsis.
    Plugin Author braekling

    (@braekling)

    Please have a look at the latest master provided via Github:
    https://github.com/braekling/WP-Matomo/archive/master.zip

    There I added handling for matomo.js/.php files if Matomo does not deliver piwik.js/.php anymore.

    Thread Starter strarsis

    (@strarsis)

    @braekling: Sorry for the delay. So I installed the plugin directly from GitHub master (downloaded the ZIP from your link, extacted it on the site).

    Now the following URL is used for the script:
    https://www.example.com/app/plugins/wp-piwik/proxy/matomo.js
    However, the script file is not found, resulting in a HTTP 404 when it is requested.
    The URL is correct insofar that I can request the matomo.php (the PHP file, not the JS file) instead (resulting in a blank screen, but it is found on the server) that resides in /app/plugins/wp-piwik/proxy/.

    Thanks in advance!

    Thread Starter strarsis

    (@strarsis)

    @braekling: Anything I could do or send to help you debugging this issue?
    I am using roots.io Bedrock WordPress site. Would a docker-compose setup help?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Built-in tracker proxy’ is closed to new replies.