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.
-
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!
@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.@braekling: Please help! Currently nothing is tracked at all with WP Matomo. π
I wonder why the browser tries do download a file in
/app/instead of/wp-content/? And it should bematomo.phporpiwik.phpinstead ofmatomo.js. Please check the generated tracking code.@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 -->@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.Can you explain
/appis used instead of yourwp-contentfolder? 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?
@braekling: The plugin shows an autogenerated code and I haven’t changed it.
The reason for why/appis 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.ww.wp.xz.cn/reference/functions/content_url/.-
This reply was modified 6 years, 6 months ago by
strarsis.
Please have a look at the latest master provided via Github:
https://github.com/braekling/WP-Matomo/archive/master.zipThere I added handling for matomo.js/.php files if Matomo does not deliver piwik.js/.php anymore.
@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 thematomo.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!
@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? -
This reply was modified 6 years, 6 months ago by
The topic ‘Built-in tracker proxy’ is closed to new replies.