Google2Piwik Exporter, version 1.7, September 2013

Google2Piwik is a Python script that helps migrating data from Google Analytics to Piwik.


  • Access to Piwik installation.
  • Google Analytics Account with read or admin rights. The Google Analytics API currently does not support Google Apps for your Domain Accounts. Thats why you can't export data from even if you have access via web interface. However you can still grant privileges to your Gmail account, and use it to perform the export.
  • Google API key (here you can get one:
  • Python 2.6 with components:

Before running the script please make sure to:

  • Edit 'google2piwik.conf' configuration file - you will find a sample in: google2piwik.conf.sample
  • Query Google API for getting your site's 'table_id' by running (remember to fill google login and pass configuration before): python -p
  • Check your configuration and verify privileges by running ./ -c
  • Create a backup of your Piwik MySQL Database
  • Set the timezone in Piwik for your site where you import data to UTC
After Export

After successful export, please go to your Piwik installation folder and run:


Unfortunately because of lack of full access to data, some statistics may be different from presented in Google Analytics.

Known NOT trustworthy statistics are:

  • Visitors -> Visitor Log statistics are not reliable. This one is generated semi-randomly to supply information about Actions (Page views, Bouncy Rate etc.)
  • Sometimes page 'Bouncy Rate' and 'Average time on page' may be slightly off to Google Analytics data
  • Providers are unknown (because Google Analytics does not supply this information)
  • Actions -> Unique Page views
  • Visitors -> Settings -> Plugins Google provides only information just about Flash Player and Java enabled.
Because of Google API Policy, there is a limit of requests per 24 hours. Exporter uses google API quota (50k requests/day). Currently this script is using 6 requests (fetching 10 000 data rows) for one exported day, plus 3 for whole period. One additional request (6th) has been added to populate visit numbers and days since last visit tables. It slowed a bit whole process of export. However number of requests depend on number of visits and total number of page views. This means that you should be able to export about 2000 days per 24h in low and medium visited sites.
After Export

Google2Piwik, from version 1.2 provides also a GUI version. In order to launch it, run the following command:

$ python
Building Binaries

  • Make sure you have all the requirements, including PyQt4
  • Get pyinstaller
  • Run: $ python /path/to/pyinstaller/ $ python /path/to/pyinstaller/ --onefile Google2Piwik/ $ python /path/to/pyinstaller/ google2piwikgui.spec
  • Copy Google2Piwik/lib/* to dist/lib/*