GoogleAnalyticsTracker
Track Vaadin application use with Google Analytics
Google Analytics is a JavaScript based tracking service for websites. With this widget you can track any application events using a simple API. The Vaadin 7 version also supports Navigator API for automatic reporting.
Vaadin version compatibility:
Add-on | Vaadin version |
---|---|
1.x | Vaadin 6.x |
2.x | Vaadin 7.x |
3.x | Vaadin 8.x |
4.x | Vaadin 10-23 |
5.x | Vaadin 24+ |
Notes
- Since version 4.1.0 (Vaadin 10) Uses GA4
- Since version 3.1.0 (Vaadin 8) Uses GA4
- Since version 2.1.0 (Vaadin 7) Universal Analytics (analytics.js) is the default.
- Since version 2.2.0 event and user-id tracking was added
- Since version 2.2.0 project structure changed
Sample code
// Create a tracker for vaadin.com domain. GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-658457-8", "vaadin.com"); // Add only one tracker per window. mainWindow.addComponent(tracker); // Track the page view tracker.trackPageview("/samplecode/googleanalytics");
package org.vaadin.googleanalytics.tracking; import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.Window; public class GoogleanAlyticsSampleApplication extends Application { private static final long serialVersionUID = 1L; @Override public void init() { Window mainWindow = new Window( "GoogleanAlyticsWidget Sample Application"); // A meaningless Label just to add some content Label label = new Label("Hello Vaadin user"); mainWindow.addComponent(label); // Create a tracker for vaadin.com domain. GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-658457-8", "vaadin.com"); // Add only one tracker per window. mainWindow.addComponent(tracker); // Track the page view tracker.trackPageview("/samplecode/googleanalytics"); // Assign main window setMainWindow(mainWindow); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
3.1 is GA4 compatible version for Vaadin 8. This is just new build with newer Maven plugins.
- Released
- 2023-06-22
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 8.0+
- Vaadin 24+ in 5.0.0
- Vaadin 23 in 4.1.0
- Vaadin 22 in 4.1.0
- Vaadin 21 in 4.1.0
- Vaadin 20 in 4.1.0
- Vaadin 19 in 4.1.0
- Vaadin 18 in 4.1.0
- Vaadin 17 in 4.1.0
- Vaadin 16 in 4.1.0
- Vaadin 15 in 4.1.0
- Vaadin 14 in 4.1.0
- Vaadin 13 in 4.1.0
- Vaadin 12 in 4.1.0
- Vaadin 11 in 4.1.0
- Vaadin 10 in 4.1.0
- Vaadin 7.1+ in 2.2.0
- Vaadin 6.0+ in 1.1.2
- Browser
- Browser Independent
GoogleAnalyticsTracker - Vaadin Add-on Directory
Track Vaadin application use with Google AnalyticsGoogle Analytics is a JavaScript based tracking service for websites. With this widget you can track any application events using a simple API. The Vaadin 7 version also supports Navigator API for automatic reporting.
#### Vaadin version compatibility:
| Add-on | Vaadin version |
| ---------- | ------------- |
| 1.x | Vaadin 6.x |
| 2.x | Vaadin 7.x |
| 3.x | Vaadin 8.x |
| 4.x | Vaadin 10-23 |
| 5.x | Vaadin 24+ |
#### Notes
* Since version 4.1.0 (Vaadin 10) Uses GA4
* Since version 3.1.0 (Vaadin 8) Uses GA4
* Since version 2.1.0 (Vaadin 7) Universal Analytics (analytics.js) is the default.
* Since version 2.2.0 event and user-id tracking was added
* Since version 2.2.0 project structure changed