Bohdan Nesteruk
Bohdan Nesteruk

Reputation: 914

Sending statistics to Google Analytics from java desktop application

I have a JavaFX desktop application which allows users to login, load and save data on remote host using HttpRequest GET and POST methods (for instance, by pressing buttons Login, Load, Save).

I'd like to monitor user's interaction with that application using Google Analytics. Are there any usage examples of how this can be done? I guess, I need to add listeners to those buttons and call GA API?

Maybe some examples of how to connect to google and what parameters need to be passed there?

Thanks in advance!

Upvotes: 3

Views: 700

Answers (1)

Bohdan Nesteruk
Bohdan Nesteruk

Reputation: 914

I found the solution using the following library It has a GA tracker constuctor where you can put your application name and tracking code:

 private static final JGoogleAnalyticsTracker MONITOR = new JGoogleAnalyticsTracker("My app", "UA-10086test-1");

And then use it's method "trackAsynchronously()" whenever you want with required description:

Main.getMonitor().trackAsynchronously(new FocusPoint("Submit login"));

Compiled it locally and added to my pom:

    <dependency>
        <groupId>jgoogleanalytics</groupId>
        <artifactId>jgoogleanalytics</artifactId>
        <version>0.5</version>
    </dependency>

enter image description here

Upvotes: 1

Related Questions