To add Google Analytics to your dashboard, you'll need a Google Service Account and a .p12-file to upload to Affiligator. Follow the steps listed below.


1. Create a Google Developers project


First of all, you'll need to create a new Google Developers project. Click here to create a new one.


2. Create a Service Account


Once you've created a Google Developers project, you'll need to create a Service Account. Follow these steps to create a new one.


3. Get the .p12-file


Once you've created a Service Account, you'll need to download the .p12-file for this Service Account.


4. Enable the Analytics API


For this step, go to the Google Developers console and enable the Analytics API.


5. Add the Service Account to Google Analytics


In this step, you'll need to add your Service Account to Google Analytics. Go to your Google Analytics dashboard and navigate to Administration > User Management. Give the Service Account 'Read and Analyse' permissions on the Google Analytics account you want to access the data from.


6. Get your Google Analytics Profile ID


You need to get your Google Analytics Profile ID. You'll find this Profile ID in the URL. Go to Google Analytics and open the dashboard of the Google Analytics account you want to access the data from. The URL will look something like this:


https://analytics.google.com/analytics/web/#embed/report-home/a1234567890w1234567890p1234567890/


Your Profile ID is the number after the 'p' at the end of the URL.


7. Enter the credentials in Affiligator


In Affiligator, go to System > Configuration and select the Analytics settings tab. Enter your Google Analytics Profile ID, your Google Analytics OAuth Client (the e-mailaddress linked with the Service Account) and upload your Google Analytics OAuth Key File (the .p12-file you've downloaded from your Service Account). Click on Save to save your changes.


If you've followed the steps correctly, a new menu item will show up, named Analytics, and you'll find 2 new dashboard items: Daily pageviews (last 7 days) and Daily visits (last 7 days). If you go to the Analytics page, you are able to choose the metrics you want to display, the date range and the type of the graph (line or bars).