Title: Built-in tracker proxy
Last modified: August 1, 2019

---

# Built-in tracker proxy

 *  [strarsis](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/)
 * 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](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-11801317)
 * Hi [@strarsis](https://wordpress.org/support/users/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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-11968719)
 * [@braekling](https://wordpress.org/support/users/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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-11991223)
 * [@braekling](https://wordpress.org/support/users/braekling/): Please help! Currently
   nothing is tracked at all with WP Matomo. 🙁
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12039053)
 * 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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12040614)
 * [@braekling](https://wordpress.org/support/users/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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12051035)
 * [@braekling](https://wordpress.org/support/users/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](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12075126)
 * 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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12080594)
 * [@braekling](https://wordpress.org/support/users/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](https://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.wordpress.org/reference/functions/content_url/](https://developer.wordpress.org/reference/functions/content_url/).
    -  This reply was modified 6 years, 7 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12097609)
 * Please have a look at the latest master provided via Github:
    [https://github.com/braekling/WP-Matomo/archive/master.zip](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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12179133)
 * [@braekling](https://wordpress.org/support/users/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](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12194112)
 * [@braekling](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3529668)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

## Tags

 * [proxy](https://wordpress.org/support/topic-tag/proxy/)
 * [script](https://wordpress.org/support/topic-tag/script/)
 * [shipped](https://wordpress.org/support/topic-tag/shipped/)
 * [tracker](https://wordpress.org/support/topic-tag/tracker/)

 * 11 replies
 * 1 participant
 * Last reply from: [strarsis](https://wordpress.org/support/users/strarsis/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/built-in-tracker-proxy/#post-12194112)
 * Status: not a support question