Contribution: Google Analytics Widget / Component

Please integrate canonical url in your add-on, it’s vital for Vaadin dynamic site, because Google picks it up as a page, for instance I put one on my main page as (“/ro”), and Google picked it up as http://lottomerc.com/ro/ro when my app’s is just http://lottomerc.com/ro. Me thinks… fine… that should count for some extra SEO, except it should go to http://lottomerc.com/ro

[url= http://stackoverflow.com/questions/9103794/canonical-url-in-analytics]

http://stackoverflow.com/questions/9103794/canonical-url-in-analytics
[/url]

there’s a lot of info on the matter:

http://search.yahoo.com/search?p=google+analytics+canonical&ei=UTF-8&fr=moz35


https://www.google.ro/search?q=http%3A%2F%2Flottomerc.com%2Fro%2FmainWindow&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#hl=ro&client=firefox-a&hs=94e&rls=org.mozilla:en-US%3Aofficial&sclient=psy-ab&q=google+analytics+canonical&oq=google+analytics+canonical&gs_l=serp.12…0i19.143534.143534.1.144712.1.1.0.0.0.0.134.134.0j1.1.0…0.0…1c.6w3Hu677o5k&psj=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=f85d7193f6ef61c&biw=1366&bih=565

Google Analytics 1.1.1 does not work with Vaadin 7 because it’s using the old API:

java.lang.ClassNotFoundException: com.vaadin.terminal.PaintTarget

PainTarget is now in a new package: com.vaadin.server.

Hi,

I’m having trouble getting this to track.

I’ve implemented it like this on a live page:

public class MyVaadinUI extends UI {

	@Override
	protected void init(VaadinRequest request) {
		// setContent(new SignupView());

		GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(
				"(my tracking code)");

		// attach the GA tracker to this UI
		tracker.extend(this);

		// simple view navigator sample
		Navigator n = new Navigator(this, this);
		n.addView("main", new MainView());
		n.addView("signup", new SignupView());

		// attach the tracker to the Navigator to automatically track all views
		// To use the tracker without the Navigator, just call the
		// tracker.trackPageview(pageId) separately when tracking is needed.
		getNavigator().addViewChangeListener(tracker);

		getNavigator().navigateTo("main");
	}

}

So far nothing seems to be tracking - any ideas?

Cheers,
D

Using GA tracker in development machine you sometimes need to set the domain parameter to make it actually track. See this for reference:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setDomainName

Hello.

I was wondering if it was possible to
view the generated javascript
code in the browser?
I’m using Firefox, and I can’t find the code via firebug.

I have also another question.
I have a page containing a button, and the business would like to invoke a “trackPageview” when the user clicks on a specific button.
Is it possible to do it via your add-on?

Thank you in advance for your help!

KR,

Hi there,

Has anyone tried using this add-on to track dialog windows in addition to views? I’m wondering how to get dialogs automatically tracked the same way views do with the ViewChangeListener (see below).

 GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("test123", "test.com");
 tracker.extend(this);
 navigator.addViewChangeListener(tracker);

I’m thinking of using the Google Event Bus, but I figured I’d ask around first.

Thanks!

Or with a listener on the addWindow method? Is that possible so when a Windows is added to the UI (displaying it) the name of the Window is tracked?

In my case I display some detailed information from a Table in a new Window. This would be quite interesting to achieve.

Did you progress in this topic Mike S?

Thanks

Fran

Hello!

Thanks for creating the GA add-on; works very well.

I was not able to find any way of tracking events with the add-on (https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide). Does the add-on not support tracking events?

Thanks,
Ankie

Despite add-on description saying: “track any application events” , _trackEvent looks like it is not supported in v1.1.2

Hi @ll.

I played a little bit around with this addon and it works like a charm.
But I want to use the User ID Param (https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id).

Is this possible?

Thanks in advance
Christoph

It’s strange. but I can’t add tracker to page as component

java.lang.ClassCastException: org.vaadin.googleanalytics.tracking.GoogleAnalyticsTracker cannot be cast to com.vaadin.ui.Component what I’m doing wrong?

I think your pattern was used with the Vaadin 6 AddOn. In Vaadin 7 use this

GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(id, domain);
// "this" is the UI
tracker.extend(this);
navigator.addViewChangeListener(tracker);

So, I wonder what is the idea behind keeping the old (Vaadin 6) samples on the add-on’s home page, thus confusing users.

I’m trying to use in Vaadin 7.6.4 but nothing has been tracked. Is this component compatible with 7.6.4?


GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(track_id, domain);
tracker.extend(UI.getCurrent());
tracker.trackPageview(“MyView”);

The guys know other alternatives for this add-on?

Thanks,
Luiz

How to set custom dimensions and metrics using the server side component. Would like to use the server side component to set custom dimensions (same as setDomainName()) but it doesn’t appear so. Can this be done server side or shall I be forced to brush up on my JavaScript talent and do it client side? Since using Vaadin (4 years ago) I have not had to write one line of JS.

Hi
I am working with vaadin 7.7.10. For me no analytics information is seen into the google analytics dashboard. Can someone let me know if i am missing something here .

add the following code in my UI class

GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker(track_id);
tracker.extend(UI.getCurrent());
navigator.addViewChangeListener(tracker)

Now, I can see that, at view change, the trackPageview->callFunction method is called. As a result I also see through chrome debugger tools that "
trackPageView
" method in Javascript is also gets called :

this.trackPageView = function(pageId) { if (self.getState().universalTracking) { self.universalTrack(pageId); } else { self.legacyTrack(pageId); } }; And the method is used

self.universalTrack(pageId); which in retun sends the pageview and page id .

    this.universalTrack = function(pageId) {
        if (pageId) {
            window._gaut('send', 'pageview', {
                'page': pageId});
        } else {
            window._gaut('send', 'pageview');
        }
    };

Unfortunately, nothings seems to arrive to google analytics dashboard.

Hello,

i have tried to insert the Plugin (Version 2.2.0) in my Vaadin 7.7.5 Maven-POM. I get the error:

INFO] >>> jetty-maven-plugin:9.3.9.v20160517:run (default-cli) > test-compile @ baukost4 >>>
[INFO]
 ------------------------------------------------------------------------
[INFO]
 BUILD FAILURE
[INFO]
 ------------------------------------------------------------------------
[INFO]
 Total time: 2.313 s
[INFO]
 Finished at: 2018-11-01T09:40:29+01:00
[INFO]
 Final Memory: 9M/155M
[INFO]
 ------------------------------------------------------------------------
[ERROR]
 Failed to execute goal on project baukost4: Could not resolve dependencies for project XXX-SNAPSHOT: Failed to collect dependencies at org.vaadin.addons:googleanalyticstracker:jar:2.2.0: Failed to read artifact descriptor for org.vaadin.addons:googleanalyticstracker:jar:2.2.0: Failure to find org.vaadin.addons:googleanalyticstracker-addon:pom:2.2.0 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced -> [Help 1]

[ERROR]
 
[ERROR]
 To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
 Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
 
[ERROR]
 For more information about the errors and possible solutions, please read the following articles:
[ERROR]
 [Help 1]
 http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

but with Version 2.1.0 everything is OK. Is currently somethings wrong with 2.2.0 or has someone an idea?