Contribution: Google Analytics Widget / Component

Hi all,

I made some code cleaning and packaging with the Google Analytics integration from the Sampler. This was made using the “new component packaging method” of Vaadin 6.2.

So, if you are already using the upcoming 6.2 series Eclipse plugin and Vaadin nightly builds just copy vaadin-ga.jar (link below) to your WEB-INF/lib and just let the plugin recompile. Done.

(The 6.2 makes it really easy distribute and install new components for Vaadin. And I really like it. :slight_smile: )

And the component is also easy to use. Here is a usage sample for the widget:

       GoogleAnalytics tracker = new GoogleAnalytics("UA-xxxxxx-x", "");

(Just change the tracking code and domain above. You find them from Google Analytics control panel.)



Source code at Vaadin contrib

Information about the Eclipse plugin for Vaadin 6.2

Just tested it and it works like a charm. Wonderful stuff, as is the 6.2 packaging mechanismi :slight_smile:

Jar file link is broken :frowning:


Sorry about that. I reorganized updated to Vaadin 6.2+ and forgot to update the link. Here it is as attachment.
11209.jar (7.02 KB)

I can’t get this working …
I tried to solve the problem by following the troubleshooting instructions given at
, without any success whatsoever.

The ga.js is loaded according to firebug (and chrome developer tools) but no request to __utm.gif is made.
Here’s my code (copy-pasted from the example):

GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-XXXXXXXX-X", "");

The above code is executed inside a Window class.

I have the same issue:
The GA script loads fine. I can even see an UIDL being sent containing all the parameters, but nothing happens.

I tried debugging this via the GWT development tools, but my computer can’t seem to handle that (I got the impression it tries to load the entirety of Vaadin for debugging)

Can any one give some pointers on what to try next?


It took me a while, but I figured it out. The Google Analytics code is pretty picky about the domain you enter. If you’re not running on that domain, it will not send out a measurement. For instance, if you’re debugging locally.

I’ve now added some extra code that will send “none” as domain when running locally. This solved the problem.


I added the component in portal use (Liferay portal) but it doesn’t seem to work.

Did anybody already try it ?

Hello All,

It seems Google Analytics tracker add-on is not accessible since few days - the add-on page is empty :

Am I missing something? I am only looking for the maven dependency configuration.

Strange. This seems to be a regression from the newest directory version deployment. We’ll investigate the issue.

Yes, this was a regression bug related to recent changes in the Directory application.

This issue is now fixed and the Google Analytics add-on is now available again.

I’m using the Google Analytics Add-on with https and my browser complains: “The page at ran insecure content from”.

Would it be possible to make the widgetset load “” if my host uses https?

I realize now that the Add-on do work, even though I get the error in the console. Maybe nothing to bother changing then.

Hello again, unfortunately Chrome will flag the site as insecure when the plugin loads the insecure version of ga.js. I notice that runs on https and uses ga.js. I would be very happy if someone could point me to how to change the plugin to work with https.

I ended up grabbing the code from the plugin, change the widgetset xml and include it as a part of my project. Thanks anyway for a great plugin!

When I try to compile the widgetset I set the following log during the compilation.

Widget class org.vaadin.googleanalytics.tracking.client.ui.VGoogleAnalytics was not found. The component org.vaadin.googleanalytics.tracking.GoogleAnalyticsTracker will not be included in the widgetset.

I have no idea why this is happening.


When I try to compile this widgetset I get the following log during the compilation.

Widget class org.vaadin.googleanalytics.tracking.client.ui.VGoogleAnalytics was not found. The component org.vaadin.googleanalytics.tracking.GoogleAnalyticsTracker will not be included in the widgetset.

Any idea reason for this??

Kind Regards

is there a way to add custom varaibles of google analytics to do analysis from different level?


I see some recent positive comments, but I can’t find anything in the svn that has a mod date after

<lp1:getlastmodified>Fri, 22 Jan 2010 09:42:28 GMT</lp1:getlastmodified>

Is this still actively maintained (granted it doesn’t look complicated, and comments seem to indicate that it still works although with what versions of vaadin is not clear from the comments).

It says 7 not supported… will that change anytime soon (does anything actually need to be done there). Currently I’m still on 6, but it would be nice to know if this solution is going to be able to move to 7.

Finally, there doesn’t seem to be any license for this library… Could whoever maintains this declare a license? Preferably something FOSS, and commercial-use friendly. Without a clearly defined license many folks can’t use this.

As far as I know, the license should be Apache 2.0 but Sami should confirm that.
Also as far as I know, there haven’t been such problems that would have required a new version.

Support for Root extensions (
, since Vaadin 7 alpha 3) together with some other alpha 3 functions should make implementing this functionality for Vaadin 7 very simple.