Skip to main content
The Java SDK makes it easy to track events from Java applications.

Installation

The Java SDK is available via JitPack.
To initialize the Java SDK in your application, create an Analytics instance:

API

Identify

The IdentifyMessage sends an identify event. Unlike the Browser SDK, it does not persist the user ID and traits locally, so user IDs must be explicitly added to other events. This is because server side events are usually servicing many different users at once. Example usage:
Method parameters:

Track

The TrackMessage sends a track event. Example usage:
Method parameters:

Page

The PageMessage sends a page event. Example usage:
Method parameters:

Screen

The ScreenMessage sends a screen event. Example usage:
Method parameters:

Group

The GroupMessage sends a group event. Example usage:
Method parameters:

Flush

The Java SDK buffers events locally before sending them to Hightouch’s servers. This minimizes the number of requests made by the SDK and makes the tracking non-blocking. To force the local buffer to be sent to Hightouch immediately call the flush method. flush should be called when shutting down your Java app to make sure no events are lost. Example usage:
Last modified on March 12, 2024