Skip to main content


Iteratively supports tracking analytics events from JRE programs written in Java (6 and above).

In Java, the tracking library exposes a type-safe function for every event in your team’s tracking plan. The function’s arguments correspond to the event’s properties and are strongly typed to allow for code completion and compile-time checks.


Generate the SDK

If you have not yet installed the Ampli CLI, install it now.

To generate the Itly SDK, run ampli pull {source} in the top-most folder of your project. By default, the SDK will be generated in ./src/main/java/io/itly/.


{source} is the name of the source you created in your tracking plan (e.g. java).

Install dependencies

To validate your analytics events, the Java SDK depends on everit-org/json-schema (Apache License 2.0). To install this dependency with Maven:

  • Edit the project's pom.xml file and add the following inside <project> (the JSON Schema validation package from Everit is published to JitPack):
  • Inside <dependencies>, add:

If you've configured Itly with Segment, you'll also need to add Segment's SDK as a dependency. Add the following inside <dependencies>:


Import into your app

To use the library, you'll need to import it first:

import io.itly.*;



Load the Itly SDK once when your application starts. The init() method accepts an options object that lets you configure how the Itly SDK works:

contextAn object with a set of properties to add to every event sent by the Itly SDK.

Only available if there is at least one source template associated with your your team's tracking plan.
disabledSpecifies whether the Itly SDK does any work. When true, all calls to the Itly SDK will be no-ops. Useful in local or development environments.

Optional. Defaults to false.
environmentSpecifies the environment the Itly SDK is running in: either production or development. Environment determines which Access Token is used to load the underlying analytics provider libraries.

The option also determines safe defaults for handling event validation errors. In production, when the SDK detects an invalid event, it will log an error but still let the event through. In development, the SDK will throw an exception to alert you that something is wrong.

Optional. Defaults to development.
destinationsSpecifies any analytics provider-specific configuration. The Itly SDK passes these objects in when loading the underlying analytics provider libraries.

loggerTo log Itly's logs to a custom logger, implement the ItlyLogger protocol and set logger to an instance of your class. The Itly SDK will call into your class with all debug, info, warn, and error-level messages.

Click here to see an example written in Java.

Optional. Defaults to standard out.

For example:

.custom(new ItlyCustomOptions(new CustomAdapter()))
.segment(new ItlySegmentOptions())
.logger(new Logger())


To track an event, call the event’s corresponding function. Every event in your tracking plan gets its own function in the Itly SDK.

For example, in the code snippet below, our tracking plan contains an event called Process Started. The event was defined with one required property called userId and one optional property called availableProcessors. The userId property's type is a string. The availableProcessors property's type an integer.

Itly.getInstance().trackProcessStarted("some-user-id", ProcessStarted.builder()