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
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");
}
}
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?
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.
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);
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 .
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?