Let's learn how to integrate Matomo:
Part 1:
What is the token_auth and where can I find this token to use in the API calls?
Token Authentication
Token Authentication Overview
The token_auth
acts as your password for authenticating API requests in Matomo. Each Matomo user has a unique token_auth
.
Generating a token_auth
Matomo 4 and Newer
Log in to Matomo.
Navigate to the Matomo Admin via the top menu.
Go to
Personal -> Security
.Click on "Create new token" at the bottom of the page.
Confirm your account password.
Enter a purpose for the token.
Click on "Create new token".
The newly created token will be displayed. Save it in a secure location, such as a password manager, as you won’t be able to view it again after leaving the screen. If the token is lost, you will need to generate a new one.
Provide API token
Provide the API token in the space provided to save it in the platform.
Matomo 3 and Older
Log in to Matomo (formerly Piwik).
Click on
Administration
the top menu.Select
API
from the left menu to find yourtoken_auth
.
If needed, the token_auth
can be re-generated by any user through Administration > Personal Settings
.
Note: Do not enable the 'Only allow secure requests' option while generating the token, as this blocks us from fetching the segment data.