Woopra/woopra-java-sdk


Woopra SDK for Java

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.woopra:woopra-java-sdk:'
	}
	dependencies {
		implementation("com.github.woopra:woopra-java-sdk:")
	}
	<dependency>
	    <groupId>com.github.woopra</groupId>
	    <artifactId>woopra-java-sdk</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.woopra" % "woopra-java-sdk" % ""
        
        

                            
    :dependencies [[com.github.woopra/woopra-java-sdk ""]]
        
        

Readme


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 mybusiness.com with your website as registered on Woopra):

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

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("mybusiness.com").withIdleTimeout(15000);

You can configure secure tracking (over https)

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

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

woopra = new WoopraTracker("mybusiness.com").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, "johndoe@mybusiness.com");
// 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", "johndoe@mybusiness.com");
//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:

woopra.identify(visitor);