A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More


Nov 2, 2009
  14182
(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.

GadgetsOverview

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…

StatisticsBrowsers

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

StatisticsDemographics.

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

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

Download the source here

Feedback

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

Nov 02, 2009

Comments

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

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

ls
ls 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?

Thanks,
Jamie
/ Jamie Shiller

Sep 21, 2010 10:32 AM

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

Regards
Jarle

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=1.0.0.0, Culture=neutral, PublicKeyToken=null] and/or types [AnalyticsGadget.Models.Profile,
AnalyticsGadget.Controllers.BaseStatisticsController,
AnalyticsGadget.Controllers.StatisticsDemographicsController,
AnalyticsGadget.Models.Report,
AnalyticsGadget.Models.ReportData,
AnalyticsGadget.Models.ReportQuery,
AnalyticsGadget.Models.DimensionType,
AnalyticsGadget.Models.MetricType,
AnalyticsGadget.Models.SortDirection,
AnalyticsGadget.Models.Timespan,
AnalyticsGadget.StatisticsHelper,
AnalyticsGadget.ChartHelper,
AnalyticsGadget.Controllers.StatisticsVisitorsController,
AnalyticsGadget.Controllers.StatisticsBrowsersController,
AnalyticsGadget.Models.ReportModel,
AnalyticsGadget.Models.ReportMetaData,
AnalyticsGadget.Models.SortBy,
AnalyticsGadget.StatisticsHelper+<>c__DisplayClass2]. Information from LoaderExceptions property [Could not load file or assembly 'EPiServer.Data, Version=1.0.238.39, 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

Jeff Wallace
Jeff Wallace 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?

Jeff Wallace
Jeff Wallace 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
-Build
-You will get a few errors that can be fixed by looking here:
http://world.episerver.com/Blogs/Cristian-Libardo/Dates/2009/12/Breaking-changes-between-EPIServer-6-CTP2-and-Release-Candidate/
-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

Cheers,
Jeff

Sep 21, 2010 10:32 AM

Thanks Mate...

Jeff Wallace
Jeff Wallace Sep 21, 2010 10:32 AM

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

http://world.episerver.com/Blogs/Jeff-Wallace/Dates/2010/8/Google-Analytics-Gadget--Updated/

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
Troubleshooting with Azure Application Insights Using KQL

Users at least get access to Azure Application Insights even within minimum access level if you are requesting access to DXP management portals at...

K Khan | Dec 21, 2025

Looking back at Optimizely in 2025

Explore Optimizely's architectural shift in 2025, which removed coordination cost through a unified execution loop. Learn how agentic Opal AI and...

Andy Blyth | Dec 17, 2025 |

Cleaning Up Content Graph Webhooks in PaaS CMS: Scheduled Job

The Problem Bit of a niche issue, but we are building a headless solution where the presentation layer is hosted on Netlify, when in a regular...

Minesh Shah (Netcel) | Dec 17, 2025

A day in the life of an Optimizely OMVP - OptiGraphExtensions v2.0: Enhanced Search Control with Language Support and Synonym Slots

Supercharge your Optimizely Graph search experience with powerful new features for multilingual sites and fine-grained search tuning. As search...

Graham Carr | Dec 16, 2025

A day in the life of an Optimizely OMVP - Optimizely Opal: Specialized Agents, Workflows, and Tools Explained

The AI landscape in digital experience platforms has shifted dramatically. At Opticon 2025, Optimizely unveiled the next evolution of Optimizely Op...

Graham Carr | Dec 16, 2025

Optimizely CMS - Learning by Doing: EP09 - Create Hero, Breadcrumb's and Integrate SEO : Demo

  Episode 9  is Live!! The latest installment of my  Learning by Doing: Build Series  on  Optimizely Episode 9 CMS 12  is now available on YouTube!...

Ratish | Dec 15, 2025 |