-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Country codes and other differences between Matomo API and Matomo for WordPress API #1252
Comments
The fields that are missing are treated as row metadata in Matomo. They should be in the output, but if they're not that would be a bug. I'll look into this.
Matomo for WordPress uses WordPress' authentication methods, so it should work to use an app password.
Thanks for noticing this, we'll fix this in the next release. |
Wouldn't it be easier if it also allowed token_auth for authentication? This way users of my app wouldn't see two separate authentication methods for the same service, could refer to the same doc, those with experience with Matomo wouldn't struggle with Matomo for WordPress... |
Plus some WP plugins (which might be bad, but are in use among WP websites...) restrict the use of application passwords (e.g. Wordfence) |
For the moment we will be sticking with WordPress' authentication methods. |
Hello, any update? |
It's still scheduled. Aiming for it to be in a release on Monday NZT. |
@demostanis can you provide the broken API output you are seeing? Calling API.getProcessedReport with Actions.getPageUrls (with and without |
hello, |
using the example request in the Matomo for Wordpress docs |
I managed to do the API request, and can see it is in reportMetadata. |
@demostanis The API.getProcessedReport has always looked like that, see for example the API output on demo.matomo.cloud: https://demo.matomo.cloud/index.php?module=API&format=XML&idSite=1&period=day&date=yesterday&method=API.getProcessedReport&apiModule=DevicesDetection&apiAction=getType&expanded=1&token_auth=anonymous&force_api_session=1&filter_limit=10 Row data and metadata are grouped together when accessing the reports directly, for example, accessing Actions.getPageUrls instead of API.getProcessedReport. For the WP REST API you'd need a REST route of That said, you should be able to access the Matomo API directly by sending requests to If you don't want to send the app password as a HTTP header, I made a recent change that will allow you to pass it in as the token_auth (you would need to set |
@diosmosis thanks for the response. Why is there no I wasn't able to use |
Hmm, it seems they simply weren't added. This was done before I started working on the project, so I can't say why. We'll probably add them in the future, but with direct API access available, it won't be as high a priority.
Yes, you're right. Apologies, it seems there's one change missing: #1263 |
Ah yes, I almost forgot, after applying #1263, you would need to add |
I'd love to apply #1263, but as I've mentionned in the beginning of this issue, I'm not able to run the project locally. Doing so leads to |
You don't need to use the packaged local environment, you can use any WordPress with the plugin installed and patched. If you're set on using the packaged local environment, you should run |
When running |
Try running |
When running |
I am using Linux |
Yes, initializing submodules was not documented, it could be. Are you still having issues then? |
I had issue with setting PORT=8080 in .env, so I kept the default of 80...
am I missing something? |
My bad, I needed to curl http://localhost/6.7.2 |
|
and idSite is not automatically guessed |
This URL works for me: I also have this in the config.ini.php:
|
with your URL, i keep getting Wordpress_TokenAuthMissing errors |
sorry, i was testing with the wrong branch the second time. i'm still getting the same issues as the first time, even with your URL:
|
It's working for me, using curl with |
I tried twice, with different wordpress instances and app passwords. Why isn't the error message more specific if it is an app password issue? |
That was a decision made in the core product. |
Lemme list my reproduction steps, so you can tell me if I messed up at any point:
|
Instead of this file: |
that seems to be it, thanks. |
We take security seriously, all changes to authentication are done with care especially before pushing to all our users. |
Hello,
I am developping an application which needs our clients' page analytics, such as page visitor count and country.
I was able to develop the part which communicates with the Matomo API as I wanted.
But when I wanted to use the WordPress API, I figured out some things don't work the same as in the Matomo API.
Firstly, when fetching
Actions.getPageUrls()
(https://mywordpress/index.php?rest_route=%2Fmatomo%2Fv1%2Fapi%2Fprocessed_report&apiModule=Actions&apiAction=getPageUrls&format=json&period=year&date=today&flat=1), theurl
field is absent, instead replaced bylabel
, which I'm not sure is a strict equivalent.Secondly, when fetching
UserCountry.getCountry()
(https://mywordpress/index.php?rest_route=%2Fmatomo%2Fv1%2Fapi%2Fprocessed_report&apiModule=UserCountry&apiAction=getCountry&format=json&period=year&date=today), thecode
field is absent, without an equivalent this time.I tried to debug the issue myself, but unfortunately I can't get the docker-compose.yml to work, with logs ranging from "address already in use" to "cannot set siteurl".
I also noticed passing in the URL parameters
format=JSON
instead offormat=json
will miss this condition, making the response encoded twice.Why is the API so different? What are the reasons
token_auth
authentication was disabled (depsite being used by the Matomo interface)?Thanks,
demostanis
The text was updated successfully, but these errors were encountered: