You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GUI (Websites/Tracking Code) and the API function SitesManager.getJavascriptTag should use the same end points: Either both matomo.js/php or both piwik.js/php.
This is an ancient Piwik site upgraded to Matomo 4.4.1.
GUI:
<!-- 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="https://example.com/piwik/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
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 -->
API:
# curl -s "https://example.com/piwik/?module=API&method=SitesManager.getJavascriptTag&idSite=1&token_auth=XXXXXX" |recode html..ascii
<?xml version="1.0" encoding="utf-8" ?>
<result><!-- 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="https://example.com/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="https://example.com/piwik/piwik.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->
Possible Solution
The outcome should be consistent for both methods.
Since wasMatomoInstalledBeforeVersion('3.7.0-b1') for this site, this site obviously shouldPreferPiwikEndpoint(). So I guess the API page is wrong using matomo.js/php.
Steps to Reproduce (for Bugs)
The demo site account lacks sufficient permissions to reproduce.
So to reproduce:
Get access to an site where wasMatomoInstalledBeforeVersion('3.7.0-b1').
In our case, it makes WP-Matomo use the legacy tracking end points piwik.js/php. We would like WP-Matomo to use the current end points matomo.js/php instead.
Your Environment
Matomo Version: 4.4.1
PHP Version: 7.3.29
Server Operating System: Debian 10.10
The text was updated successfully, but these errors were encountered:
@mssc-hoffleit this is actually expected behaviour. We still return piwik.php in the API to not regress anything there. We can't return matomo.php there for older installations as that endpoint might not be accessible and would break the tracking. Therefore to keep BC by returning piwik.php. But in the UI we recommend matomo.php so when someone copy/pastes the tracking code for a new site then the new recommended endpoint will be used.
If you would like to get matomo.php in the API as well then you can append &forceMatomoEndpoint=1 in the API request.
tsteur
added
worksforme
The issue cannot be reproduced and things work as intended.
and removed
Potential Bug
Something that might be a bug, but needs validation and confirmation it can be reproduced.
labels
Aug 31, 2021
Is there any way to set forceMatomoEndpoint=1 in the Matomo configuration?
Would be reasonable for sites which have been fully migrated to the new end points.
As an example, we're using WP-Matomo. WP-Matomo calls SitesManager.getJavascriptTag to autoconfigure the Matomo setup for the site (fetching the tracker code etc.). It feels odd when I would have to manually reconfigure WP-Matomo to use &forceMatomoEndpoint=1 just in order to make auto configuration work (apart from the fact that WP-Matomo doesn't support this, currently).
@mssc-hoffleit forcing it to use that endpoint without a parameter would be only possible by developing a small custom plugin unfortunately. If you are using WP-Matomo then I would suggest maybe to create an issue there to offer an option the Matomo endpoint there maybe?
Expected Behavior
The GUI (Websites/Tracking Code) and the API function SitesManager.getJavascriptTag should use the same end points: Either both matomo.js/php or both piwik.js/php.
Current Behavior
The GUI ("https://example.com/piwik/module=CoreAdminHome&action=trackingCodeGenerator&idSite=1") shows Javascript code with "matomo.php" und "matomo.js".
The API ("https://example.com/piwik/?module=API&method=SitesManager.getJavascriptTag&idSite=1") delivers the same Javascript snippet, but with "piwik.php" und "piwik.js".
This is an ancient Piwik site upgraded to Matomo 4.4.1.
GUI:
API:
Possible Solution
The outcome should be consistent for both methods.
Since wasMatomoInstalledBeforeVersion('3.7.0-b1') for this site, this site obviously shouldPreferPiwikEndpoint(). So I guess the API page is wrong using matomo.js/php.
Steps to Reproduce (for Bugs)
The demo site account lacks sufficient permissions to reproduce.
So to reproduce:
Context
In our case, it makes WP-Matomo use the legacy tracking end points piwik.js/php. We would like WP-Matomo to use the current end points matomo.js/php instead.
Your Environment
The text was updated successfully, but these errors were encountered: