Thursday 11 April 2013

I Discovered a Way To Share over 200 Analytics Metrics from your Site to the Public

by +Mina Adly Younan
There are many visitors counters outside that you can embed in your website and let anyone see how many visitors you get and from where.

But what if you want to share more detailed and technical data like average visit duration, or traffic sources, or searched terms, or user behavior. i.e. Google Analytics data for public.

Or, You might have a client who wants to watch his Analytics important information always updated on a friendly dashboard without having to login any Analytics accounts and search for data.

I did not invented the method. It is an API created by Google to link Google Analytics with your Google Drive spreadsheets. But how it can be used to present the data for the public is simply by linking Google Drive with Google Sites to import all the generated data (in a Graph format) and present them online where you can decide either to make it public and iframe it in your website or make it private and give access only to those who matter.

How To link Google Analytics with Google API with Google spreadsheets with Google Sites with Your site?


It may sound complicated but believe me it is not rocket science. You can do it all in 10 minutes max.

here we go: (of course You need to make sure that all the Google Products are under the same user)


  1. Go to Google Drive and Create new Spreadsheet
  2. Open Tools > Script Gallery
  3. Search for "Google Analytics" and select Analytics Report Automation (Magic) script, and install it
  4. After authorizing the script go back to the spreadsheet and select again tools > script editor
  5. Go to Resources > use Google APIs
  6. Enable Google Analytics (switch it on) Then click on Google APIs Console 



7- A new tab will open 
8- Click API Project (drop-down menu on the left corner) > Create 
9- Type the project name and press Create
10- Enable Analytics API (under the All services)


11- On the left hand side menu click on API Access 
12- Under the Simple API Access you will find an API key. Copy that key, close the tab and paste it in the previous script tab. Then click the save button.
UPDATE: You Do not have to copy and Paste the API Key anymore




13- Close the script tab and refresh the spreadsheet tab. 
14- A new Menu Item called Google Analytics" will appear on the top. > Go to Create Core Report


15- Authorize Google Apps Script to access Analytics (sometimes you have to repeat step 14)
16- To get the data out of the GA click the Google Analytics menu again > Find Profile /ids
17- Copy the GA parameter and paste it in the ids section and put the number of days you want (28 for last month) and the file name in the "sheet-name" 
18- for the whole 200 dimensions and metrics you will find them here:


19- click the Google Analytics menu again > get Data
20- Highlight the data you got and click on "insert Chart" to have them in a graphical visualization 


How to Automate Google Analytics Reporting Script? 

To pull this data every specific time, you can use the triggers tool of the Google spreadsheets

21- Tools > Script editor. 
22- Resources > all your Triggers > Add a new Trigger > select Get data  menu item  > define the frequency (e.g. every hour) Click Ok and SAVE the script. 

How To create a Public or Private Dashboard to visualize the Analytics data?  

23- Go to Google sites  > Create a new site > go to edit a page 
24- click on the insert menu and click Chart > select the spreadsheet chart you've created before. > SAVE



Now you can share this site, make it public or keep it private. 
You can also insert it in any other site  

and here we are, all the GA data you want in one place, updated and friendly presented. 



For more resources: