Have a question?

Java SDK

Track customers directly in Java using Woopra’s Java SDK

Download the SDK

Download Java SDK from GitHub

Java SDK Documentation

This SDK allows our users with servers running Java to track visitors by writing only Java code. Tracking directly in Java enables visitor tracking through the back-end without having to handle http requests manually.

Setup the tracker SDK by configuring the tracker instance as follows (replace mybusiness.com with your domain as registered on Woopra):

woopra = new WoopraTracker("mybusiness.com");

You can then 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.setIdleTimeout(15000);

For custom event tracking, create an instance of WoopraEvent:

event = new WoopraEvent("play", new Object[][] {
   {"artist", "Dave Brubeck"},
   {"song", "Take Five"},
   {"genre", "Jazz"},
});
// alternatively:
event = new WoopraEvent();
event.setName("play");
event.setProperty("artist", "Dave Brubeck");
event.setProperty("song", "Take Five");
event.setProperty("genre", "Jazz");

For visitor tracking, create an instance of WoopraVisitor (the user who triggered the event). You can choose to identify the visitor by EMAIL, or with a UNIQUE_ID of your choice (make sure to re-use the same ID for a given visitor across different visits).

// WoopraVisitor identified by email:
visitor = new WoopraVisitor(WoopraVisitor.EMAIL, "johndoe@mybusiness.com");
// WoopraVisitor identified by unique ID:
visitor = new WoopraVisitor(WoopraVisitor.UNIQUE_ID, "MYUNIQUEID");
// In both cases, then add visitor properties:
visitor.setProperty("email", "johndoe@mybusiness.com");
//This step is not required if the visitor has been instantiated by email
visitor.setProperty("name", "John Doe");
visitor.setProperty("company": "My Business");

Now, you’re ready to start tracking events:

woopra.track(visitor, event);

Or just push visitor data (without event tracking):

woopra.push(visitor);

Need any help? Contact our Data Jedis