I’m new to Piwik (love it!) and programming in general. I have a Piwik widget embedded in a private page. In Google Chrome, when I log in to the private page (via the CMS’s login system, not Piwik), I can view the widget. Then I log out and I try the process again in Safari, except the page gives me this error instead of showing the widget:
“You can’t access this resource as it requires an ‘view’ access for the website id = 1”
The widget is the Visits Overview w/ Graph. I’ve created a User for this Website and added that User’s token_auth to the end of the embedded URL. Perhaps I am supposed to adjust the token_auth a certain way when adding it to the end of the URL? In the end of the URL, I add it immediately next to where it says “widget=1,” for greater clarity, alongside the “1”…
I’m sure there is something simple on my end that I am forgetting. Does anyone have any suggestions?
Thank you for your interest Matt. I solved the problem. I was not adding " &token_auth= " before the actual token_auth number. Maybe I missed that step in the documentation or it is just presumed understood by all web developers… I’m new to programming in general so I didn’t know.
"Then, copy the ‘token_auth’ of this user from the Manage Users page, and paste it at the end of the widget URL in the Widget embed HTML code: &token_auth=your_token_auth_here "
I’m using the Python Reporting API Client which is available here.
from piwikapi.analytics import PiwikAnalytics
pa = PiwikAnalytics()
pa.set_api_url('http://10.***.***.***:10443/piwik/index.php?')
pa.set_id_site(3)
pa.set_method('ImageGraph.get')
pa.set_parameter('apiModule', 'UserCountry')
pa.set_parameter('apiAction', 'getCountry')
image = pa.send_request()
When I try to execute the above code I get the following error Error: You can\'t access this resource as it requires an \'view\' access for the website id = 3.
I found the above code somewhere in the above library’s reference document.