Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. Java Tracker
  6. Setup

Setup

Integration options

Tracker compatibility

The Snowplow Java Tracker has been built and tested using Java versions 8, 11 and 13, so should work within any Java application built using JDK8 upwards.

Dependencies

To minimize jar bloat, we have tried to keep external dependencies to a minimum. For the full list of dependencies, please see our Gradle build file.

Setup

Hosting

The Tracker is published to Snowplow’s hosted Bintray Maven repository, which should make it easy to add it as a dependency into your own Java app. From v0.9.0, the Tracker is also published to Maven Central.

The current version of the Snowplow Java Tracker is 0.10.1

You can also manually insert the Tracker by downloading the jar directly: snowplow-java-tracker-0.10.1.jar

Maven

If you are using Maven for building your Java application, then add the following code into your HOME/.m2/settings.xml to be able to use this repository:

<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd' xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <profiles> <profile> <repositories> <repository> <snapshots> <enabled>falseenabled> snapshots> <id>bintray-snowplow-snowplow-mavenid> <name>bintrayname> <url>https://snowplow.bintray.com/snowplow-mavenurl> repository> repositories> <pluginRepositories> <pluginRepository> <snapshots> <enabled>falseenabled> snapshots> <id>bintray-snowplow-snowplow-mavenid> <name>bintray-pluginsname> <url>https://snowplow.bintray.com/snowplow-mavenurl> pluginRepository> pluginRepositories> <id>bintrayid> profile> profiles> <activeProfiles> <activeProfile>bintrayactiveProfile> activeProfiles> settings>

Then add into your project’s pom.xml:

<dependency> <groupId>com.snowplowanalyticsgroupId> <artifactId>snowplow-java-trackerartifactId> <version>0.10.1version> dependency>

Gradle

If you are using Gradle in your own Java application, then add our Maven repository in your build.gradle file:

repositories { maven { url "https://snowplow.bintray.com/snowplow-maven" } }

Alternatively, our Maven repository is linked to Bintray jcenter so you can use the built in jcenter() repository or you can use Maven Central with mavenCentral().

Then add into the same file:

dependencies { // Snowplow Java Tracker implementation 'com.snowplowanalytics:snowplow-java-tracker:0.10.1' }

From 0.10.1 you can also specify the feature variants via Gradle, to pull in the required optional dependencies.

Adding OkHttp Support

dependencies { implementation 'com.snowplowanalytics:snowplow-java-tracker:0.10.1' implementation ('com.snowplowanalytics:snowplow-java-tracker:0.10.1') { capabilities { requireCapability 'com.snowplowanalytics:snowplow-java-tracker-okhttp-support:0.10.1' } } }

Adding ApacheHttp Support

dependencies { implementation 'com.snowplowanalytics:snowplow-java-tracker:0.10.1' implementation ('com.snowplowanalytics:snowplow-java-tracker:0.10.1') { capabilities { requireCapability 'com.snowplowanalytics:snowplow-java-tracker-apachehttp-support:0.10.1' } } }

SBT

The Snowplow Java Tracker is also usable from Scala. Add this to your SBT config:

// Resolvers val snowplowRepo = "Snowplow Repo" at "https://snowplow.bintray.com/snowplow-maven/" // Dependency val snowplowTracker = "com.snowplowanalytics" % "snowplow-java-tracker" % "0.9.0"