Add site on piwik by api


#1

I’m using the zend library service piwik to integrate my platform with
piwik.

This is the code for the call to piwik:

$piwik = new Zend_Service_Piwik();
$piwik->setAuthToken(‘anonymous’)
->setIdSite(2)
->setHost(‘http://stats.dev.loc/piwik/’);
$response = $piwik->SitesManager()->queryApi(“SitesManager.addSite”, $params);

It gives me this error:

Message: One mandatory setting (tokenAuth, idSite, Host or Method) is
empty.

could help me solve it?

Thank you very much.


(Matthieu Aubry) #2

Sorry i’ve never used the Zend lib. Maybe it has a bug or maybe you are misusing it. The code of the lib should be simple so I suggest you try and look in the code to understand this error.


#3

I think you cannot authenticate with ‘anonymous’ on the server in this module. You would be needing access rights to create new sites, I guess.