To do this, you will have to generate an authentification token from Matomo for security. By default, your stats are not public. A token is like a password to access your data.
To create an authentification token, sign in to your Matomo administration (Cloud or self-hosted).
Then go to Administration, Personal, Security page.
From Auth tokens section, click Create New Token button.
Enter your password.
Add a description for your token to help you know where you’re using it.
Click Create New Token button.
Make sure to manually copy the token. Paste it to “Matomo Authentification Token” field from your WordPress admin, SEO, Analytics settings page, Matomo tab.
After doing this, you can click on “I CONFIRM I COPIED THE TOKEN AND UNDERSTAND I SHOULD NOT SHARE THIS TOKEN WITH ANYONE ELSE. GO BACK TO SECURITY PAGE.“.
If you lost your token, you will have to recreate one.
Go to your WordPress dashboard page, you can now visualize your Matomo statistics from the dedicated widget.
Pretty cool right?