Skip to content

tamber/tamber-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tamber Java Bindings

You can sign up for a Tamber account at https://tamber.com.

Requirements

Java 1.7 and later.

Installation

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.tamber</groupId>
  <artifactId>tamber</artifactId>
  <version>0.1.2</version>
</dependency>

Manual

Install the following JARs:

Usage

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.