Wordpress: importing piwik data

Hi,
I’m using wordpress and wp-piwik plugin in order to import data into my Web site. However, the plug in does not support the import of visitor map even if this is planned as long term feature link.
I read this guide about importing data into Web sites. I would like to have public access (not password protected) to my data without giving anonymous access.
Is there any way to achieve this?
Thank you

1 Like

Hi,

I guess you already know that you can embed the user map using this iFrame:

<div id="widgetIframe">
  <iframe width="100%" height="350"
    src="https://demo.piwik.org/index.php?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=UserCountryMap&actionToWidgetize=visitorMap&idSite=3&period=day&date=yesterday&disableLink=1&widget=1"
    scrolling="no" frameborder="0" marginheight="0" marginwidth="0">
  </iframe>
</div>

But this assumes that the anonymous user is able to access the reports of this report, so your real issue is the authentification.

You can add an auth_token of a user to your request and view the widget this way, but that makes the credentials of a user public, which I guess you want to avoid.
&token_auth=access_token_of_a_user_who_has_access_to_the_report

I don’t think Piwik has a solution to this issue (yet), but there is an (rather old) feature request:

One solution would be writing an script that forwards just this single API request to Piwik. (As in: the visitor requests https://yoursite.example/yourscript.php and recieves the content of https://demo.piwik.org/index.php?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=UserCountryMap&actionToWidgetize=visitorMap&idSite=3&period=day&date=yesterday&disableLink=1&widget=1&token_auth=the_secret_token.
But this will get difficult with the real-time map as it requests the live-data directly from Piwik.

Another solution (I don’t know if it works) would be writing an piwik plugin that makes just the real-time-map public without an auth_token needed.

Ok thank you for the effort. In few words, there is not any real solution.

1 Like

But now that I think about it, a question arises:
What is the use case where you wan’t to make the live map publically, but the rest of the data not?

After all the visitor map includes nearly all data Piwik tracks (including IP-Adress and exact Location)

I’m creating a Web site for an NGO and they asked me about a visitor map. However, giving the access to full data I do not think it is a good idea as done by anonymous account.
Do you suggest to do so?
Thank you

Hi,

I wouldn’t recommend giving visitors access (via the anonymous account or a publicly readable token), but I’m currently missing a better idea.

Maybe someone else has an idea?

If you are fluent in PHP, you could create a user with view access and then create a plugin that limits access for this user only to this report. This may be quite a bit tricky though. You could listen to this request.dispatch event Events - Piwik Analytics - Developer Docs - v3 and only allow certain modules/actions to be called when the user has a certain username for example.

Right now this would be the only thing I can think of besides proxying somehow all requests.

1 Like

Hi,
thank you for the answer, but I do not have enough expertise and time to afford such project.
I hope that someone will fix it.

Any update about this?

Hi,
As the GitHub feature request has not really been updated for 9 years, I think there hasn’t been anything new on this subject…
Maybe add an up in the GitHub feature request?

1 Like

Hi,
it would be great. Can you provide me the link?

1 Like