Google Analytics data in a SharePoint list

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.

image

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

6 Comments

Dnaiel Rajkumar

Reply

This looks great; I’ve been looking for a webpart that retrieves Google Analytics API data into SharePoint. What should I expect after running the exe? There is no readme and I’m not sure how to install the code. I was hoping that it might come with a wsp file, or some installation instructions.

Thanks for creating it Jacob & thanks René for the post. I’d be happy to make a donation Jacob, if you could complete this as a configurable webpart to retrieve whatever data is needed from Analytics.

Thanks

 

René Hézser

Reply

Hi Daniel,
… a console application … list will be created … parameters …

Just copy the exe to your SharePoint Server, open up a command prompt, navigate to the exe and execute it. Pass parameters and see how a list will be created and magically filly with Google Analytics data.

René

 

Reuben

Reply

Is this compatible with SharePoint 2010?

 

Can I display Google Analytic results form an external site on SharePoint? | DL-UAT

Reply

[…] http://www.hezser.de/blog/2010/01/06/google-analytics-data-in-a-sharepoint-list […]

 

Joseph

Reply

Hi,

Thanks for the C#API code.
I am trying to use your code but it is giving me a 404 Not Found exception (in GetAccounts() method)
var req = (HttpWebRequest) WebRequest.Create(“https://www.google.com/analytics/feeds/accounts/default”);

Please can u guide me what needs to be done as the above url could not be found.

Thanks,
Joseph

 

    René Hézser

    Reply

    Hi Joseph,
    I guess the URL has changed after 5 years.
    Please consult the documentation on the Google Analytics page, since I do not use the tool anymore.

    René

     

Leave a Reply