Jarle Friestad
Nov 2, 2009
  13688
(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

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

Jarle Friestad
Jarle Friestad 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

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

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:

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

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
Copy Optimizely SaaS CMS Settings to ENV Format Via Bookmarklet

Do you work with multiple Optimizely SaaS CMS instances? Use a bookmarklet to automatically copy them to your clipboard, ready to paste into your e...

Daniel Isaacs | Dec 22, 2024 | Syndicated blog

Increase timeout for long running SQL queries using SQL addon

Learn how to increase the timeout for long running SQL queries using the SQL addon.

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Overriding the help text for the Name property in Optimizely CMS

I recently received a question about how to override the Help text for the built-in Name property in Optimizely CMS, so I decided to document my...

Tomas Hensrud Gulla | Dec 20, 2024 | Syndicated blog

Resize Images on the Fly with Optimizely DXP's New CDN Feature

With the latest release, you can now resize images on demand using the Content Delivery Network (CDN). This means no more storing multiple versions...

Satata Satez | Dec 19, 2024