You can sign up for a Tamber account at https://tamber.com.
Java 1.7 and later.
Add this dependency to your project's POM:
<dependency>
<groupId>com.tamber</groupId>
<artifactId>tamber</artifactId>
<version>0.1.2</version>
</dependency>
Install the following JARs:
- The Tamber JAR from https://github.com/tamber/tamber-java/builds
- JSON Simple from http://json-simple.googlecode.com/files/json-simple-1.1.1.jar
- JSON from https://code.google.com/p/org-json-java/downloads/list
- Apache HTTP Components from https://hc.apache.org/downloads.cgi.
Example.java
import com.tamber.Tamber;
import com.tamber.exception.TamberException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public class TamberExample {
public static void main(String[] args) {
Tamber tamber = new Tamber("your_project_key", "your_engine_key");
//Create Event
HashMap<String,Object> eventParams = new HashMap<String,Object>();
eventParams.put("user", "user_rlox8k927z7p");
eventParams.put("item", "item_wmt4fn6o4zlk");
eventParams.put("behavior", "like");
//Set get_recs to return fresh suggestions for the user [Optional]
eventParams.put("get_recs", new HashMap<String,Object>());
JSONObject resp = new JSONObject();
try{
JSONObject resp = tamber.event.track(eventParams);
} catch(TamberException e) {
e.printStackTrace();
}
}
}
See Tests for more examples.