User specific dashboard in rails app

I’m trying to dynamically assign a dashboard like so:

Unfortunately, the PIWIK_URL and PIWIK_TOKEN are set in the application initializer(otherwise they throw an error) and the dashboard displayed is as the superuser and not as the user with the token provided in the iframe url.

Is there a different way to call the dashboard then this or possibly a different way to call the superuser credentials without dynamic constant assignment?

Hi there,

could you create another User in your Piwik that has only acces to the right site?
if you need to create users automatically you can use the UsersManager API: Reporting API Reference: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3

I am creating users via the api. The problem is the admin token is in overriding the user token I pass.