Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (51 sloc) 1.89 KB

mixpanel-java

A simple Mixpanel API for Java

Installation

<repositories>
  ...
  <repository>
    <id>github-repo</id>
    <url>http://raw.github.com/eranation/mixpanel-java/master/localrepo</url>
  </repository>
</repositories>
...
<dependencies>
  ...
  <dependency>
    <groupId>org.eranmedan</groupId>
    <artifactId>mixpanel-java</artifactId>
    <version>0.0.2-SNAPSHOT</version>
  </dependency>
</dependencies>

Example usage

 String uniqueId = "50479b24671bf";
 String nameTag = "Test Name";
 String ip = "123.123.123.123";
 Date time = new Date();
 String token = "e3bc4100330c35722740fb8c6f5abddc";
 Map<String, String> props = new HashMap<String, String>();
 props.put("action", "play");
 Logger logger = LoggerFactory.getLogger("MixpanelAPI Test Logger");

 MixpanelAPI mixpanelAPI = new MixpanelAPI(token, logger);

 mixpanelAPI.track("test1", uniqueId, props);
 mixpanelAPI.track("test2", uniqueId, nameTag, ip, time, props);
 mixpanelAPI.track("test3", uniqueId, nameTag, ip, time);
 mixpanelAPI.track("test4", uniqueId, nameTag, ip);
 mixpanelAPI.track("test5", uniqueId, nameTag);
 mixpanelAPI.track("test6", uniqueId);

Tests

# in the src/test/java directory

mvn test

Attribution/Credits

Copyright (c) 2012 Eran Medan

License

Released under the MIT license. See file called LICENSE for more details.