Skip to content
Woopra SDK for Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Track customers directly in Java using Woopra's Java SDK

The purpose of this SDK is to allow our customers who have servers running Java to track their users by writing only Java code. Tracking directly in Java will allow you to track your users through the back-end without having to handle http requests manually.

The first step is to setup the tracker SDK. To do so, configure the tracker instance as follows (replace with your website as registered on Woopra):

woopra = new WoopraTracker("");

You can also configure the timeout (in milliseconds, defaults to 30000 - equivalent to 30 seconds) after which the event will expire and the visit will be marked as offline:

// set the timeout to 15seconds:
woopra = new WoopraTracker("").withIdleTimeout(15000);

You can configure secure tracking (over https)

woopra = new WoopraTracker("").withSecureTracking(true);

You can configure http basic auth (You will need to configure basic auth tracking in your Woopra account first):

woopra = new WoopraTracker("").withBasicAuth("User..", "Pass...");

To track an event, you should first create an instance of WoopraEvent...

event = new WoopraEvent("play").
      withProperty("artist", "Dave Brubeck").
      withProperty("song", "Take Five").
      withProperty("genre", "Jazz");

... and an instance of WoopraVisitor (the user who triggered the event). You can choose to identify the visitor with his EMAIL, or with a UNIQUE_ID of your choice (in this case, make sure to re-use the same ID for a given visitor accross different visits).

// a WoopraVisitor identified with his email:
visitor = new WoopraVisitor(WoopraVisitor.EMAIL, "");
// a WoopraVisitor identified with a unique ID:
visitor = new WoopraVisitor(WoopraVisitor.UNIQUE_ID, "MYUNIQUEID");
// In both cases, you can then add visitor properties:
visitor.setProperty("email", "");
//no need to do that if you already instanciated the user with his email
visitor.withProperty("name", "John Doe").withProperty("company", "My Business");

And you're ready to start tracking events:

woopra.track(visitor, event);

Or just push the user information (without event tracking) by doing:

You can’t perform that action at this time.