Piwik create export from Google Analytics and import without shell

I came accross the tool Google2Piwik and wanted to use it to import from Google Analytics to Piwik, but I don’t have shell access to the site I run. This is my solution:

  • After installing Piwik via FTP I got myself a server API key for Google Analytics.
  • I created a dump of the database (phpmyadmin) from Piwik and imported it into my local mysql server.
  • I git cloned the Google2Piwik github project to my local linux client and edited the config file to include the Analytics server token and the database data from the client.
  • After running the Google2Piwik tool I had all the data in the local database. I exported _log_action, _link_visit_action and _log_visit.
  • I imported the export into the original site.

To then force Piwik to create the required archives I used this command

http://yoursite.com/piwik/index.php?module=API&method=CoreAdminHome.invalidateArchivedReports&idSites=2&dates=2014-02-01&token_auth=XYZ

You need to change:

  • Sites= to the actual number of your site
  • dates= to the earlyest date of your Analytics export
  • token_auth= to the piwik auth token

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.