Try our conversational search powered by Generative AI!

Jarle Friestad
Nov 2, 2009
(4 votes)

Google Analytics Gadget

Here is another little contribution to the Gadget Contest 2009. I was not sure what i was going to make util today when i discovered the Google Analytics Export API. The API let you export statistics recorded from Google Analytics javascript and use them in you own application. Be ware of that the Export API is still its early beta phase and may change with time. But still, fun to play with :-)

One thing that i know web editors like is to track their users. How many users, where they are, what they visit, what browser etc they use. Gadgets are a prefect whay of displaying this kind of information. I could make one big godly where they could choose between different reports. But i thought, the less the users need to configure the better. So i desided to splitt the reports into different gadgets. The editor could then just add the wanted reports into the dashboard.


Beneath you can see a demontration of the Browser report displaying how many users use the different kind of web browsers. As you can see on the screenshot you can select data from different sites using the dropdown. The site dropdown is automagicaly populated based on the logon account for the gadget on Google Analytics. This means its not limited to the episerver site itself. The current relase of this gadget only support a basic time drill down: Today, this week, this month and this Year. Maybe a post a updated version of this gadget in the near future…


Another cool report is the demographic report showing the visitors in a map overlay.


By the way, all of these graphs used by this gadget is made using the Google Chart API

For the installation:

This gadget installes as module (this seems to be a popular way of doing things lately)

Download the installer here

The only thing you have to do after you have installed the gadget through the EPiServer Deployment Center is to update web.config with the username and password for the Google Analytics Account

   <add key="AnalyticsGadget.Username" value="username" />
   <add key="AnalyticsGadget.Password" value="password" />

Download the source here


If you have any feedback on this gadget, please don’t hesitate leaving a comment :-)

Nov 02, 2009


Fredrik Josefsson
Fredrik Josefsson Sep 21, 2010 10:32 AM

Looks very interesting, will try this out as soon as possible

Sep 21, 2010 10:32 AM

This is certainly something that would be very useful for me as webmaster and editor. Great work!

Sep 21, 2010 10:32 AM

Is it possible to install this Gadget to iGoogle or Google Desktop? How can that be done?

/ Jamie Shiller

Jarle Friestad
Jarle Friestad Sep 21, 2010 10:32 AM

Sorry Jamie. This module is specific for EPiServer CMS 6.


Sep 21, 2010 10:32 AM

Tried to install this on our site didnt work. We created a new empty site via deployment center and directly after that installed the module there. The same exception was thrown again. We are using CMS6, .NET Framework 3.5, Windows 7 and IIS7.
Someone had the same problem?

Unable to load one or more of the requested types. The following information may be a subset of the Type/LoaderException information present - inspect with debugger for complete view.
Check assemblies [AnalyticsGadget, Version=, Culture=neutral, PublicKeyToken=null] and/or types [AnalyticsGadget.Models.Profile,
AnalyticsGadget.StatisticsHelper+<>c__DisplayClass2]. Information from LoaderExceptions property [Could not load file or assembly 'EPiServer.Data, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)].

/ Jon

Sep 21, 2010 10:32 AM

Jon, I'm wondering this issue was caused my this gadget being built during CMS 6 Beta, rather than RTM. Were you able to fix it? Jarle, could this be the case and if so is there an update?

Sep 21, 2010 10:32 AM

Gents, I just set this up myself. The problem is caused by the dll's provided being compiled against the pre-RTM CMS 6 version. Do the following:

-Download the code from the URL above in the main blog text
-Open the AnalyticsGadget.project (if you get an error you probably need to install MVC 1.0)
-Remove the references to EPiServer.Data and EPiServer.Shell
-Add new references to these dll's for the RTM CMS 6
-You will get a few errors that can be fixed by looking here:
-Do a find in files for "EPiServer.Shell.Extensions" and replace all references with "EPiServer.Shell.Web.Mvc.Html" (this is also noted at the breaking changes URL previously mentioned)
-The previous step will change 4 files. Make sure you copy each of those files to their respective directory for the actual site if you are not building from your actual site directory
-Rebuild All
-Copy the AnalyticsGadget.dll to your sites bin directory
-Refresh your site
-Have a pint


Martin Lannsjö
Martin Lannsjö Sep 21, 2010 10:32 AM

Thanks Mate...

Sep 21, 2010 10:32 AM

Updated installer for the CMS 6 RTM (and soon code) can be found here:

Jan Montano
Jan Montano Dec 13, 2011 11:34 PM

This is very cool. I used Jeff's updated installer o a CMS 6 R2 and everything is OK. I can see the gadgets well.

The only issue I’m having right now is it’s able to see all accounts from that profile.
The google analytics ID attached to the EPiServer site is an Administrator, that’s why it’s able to see all accounts from the GA Profile.
And attaching a simple Google analytics user ID, would result in an error for the gadgets.

I Get an Internal server error [500] when using a normal GA account.

[Inner exception WebException: The remote server returned an error: (403) Forbidden.]
at System.Net.HttpWebRequest.GetResponse()
at Google.GData.Client.GDataRequest.Execute()

But Doesn't get an error when using an Admin GA account.

Would this be a limitation of the module?

As we'll be giving Dashboard access to the client, we would only want them to see their site's GA details.

Please login to comment.
Latest blogs
Headless forms reloaded (beta)

Forms is used on the vast majority of CMS installations. But using Forms in a headless setup is a bit of pain since the rendering pipeline is based...

MartinOttosen | Mar 1, 2024

Uploading blobs to Optimizely DXP via PowerShell

We had a client moving from an On-Prem v11 Optimizely instance to DXP v12 and we had a lot of blobs (over 40 GB) needing uploading to DXP as a part...

Nick Hamlin | Mar 1, 2024 | Syndicated blog

DbLocalizationProvider v8.0 Released

I’m pleased to announce that Localization Provider v8.0 is finally out.

valdis | Feb 28, 2024 | Syndicated blog

Epinova DXP deployment extension – With Octopus deploy

Example how you can use Epinova DXP deployment extension in Octopus deployment.

Ove Lartelius | Feb 28, 2024 | Syndicated blog