Google Analytics data in a SharePoint list

Jacob Reimers has written an C# API for accessing Google Analytics data.image

When I saw his post, I thought it would be great to fetch the latest data every day, and write it to a SharePoint list. Then you can use the data, without querying Google for every request.

You could then use the ChartPart for SharePoint to generate nice charts from your Google Analytics data.

E.g. one for the visits for the last month. Or from which country your visitors come.image

So how do I get the data?

A console application is started via task scheduler every day. It fetches the data from the previous day, and stores it in my local SharePoint list.


The list and all required fields are created, if it does not exist.

There are some parameters, which will be used:

  • WebUrl – specify the Url to a SharePoint site
  • ListName – a list in the site (title of the list)
  • GoogleLoginName – your account name with Google
  • GooglePassword – your Google account password
  • GoogleTitle – the title of a website within Google Analytics
  • StartDate – optional. If not specified, the last day will be used

With the parameters, the call to the application might look like this:

RH.ImportGoogleAnalytics -WebUrl=http://sharepointurl/weburl -ListName=“Google Analytics” -GoogleLoginName=your@email.tld -GooglePassword=YourPassword -GoogleTitle=www.yourdomain.tld [-StartDate=mm.dd.yyyy]

If the StartDate parameter is omitted, data for the last day will be fetched.

Of course you can change the code to get different data from Google Analytics. There is plenty of information. You can take a look at the data with the Data Feed Query Explorer.

  Download the program and source code