Browse files

Add custom url to send events to

  • Loading branch information...
1 parent bc606e8 commit 7f8c5fb2a17827ba2f1895d51b1e92f272f07009 Anlu Wang committed Mar 28, 2012
View
BIN MPMetrics_v1.2.1.jar
Binary file not shown.
View
BIN bin/classes/com/mixpanel/android/mpmetrics/MPMetrics$TrackTask.class
Binary file not shown.
View
BIN bin/classes/com/mixpanel/android/mpmetrics/MPMetrics.class
Binary file not shown.
View
16 src/com/mixpanel/android/mpmetrics/MPMetrics.java
@@ -33,17 +33,17 @@
public class MPMetrics {
private static final String LOGTAG = "MPMetrics";
- private static final String API_URL = "http://api.mixpanel.com";
- private static final String ENDPOINT_TRACK = API_URL + "/track?ip=1";
private static final int BULK_UPLOAD_LIMIT = 40;
private static final int FLUSH_RATE = 60 * 1000; // time, in milliseconds that the data should be flushed
// Remove events that have sat around for this many milliseconds
- private static final int DATA_EXPIRATION = 1000 * 60 * 60 * 12; // 12 hours
+ private static final int DATA_EXPIRATION = 1000 * 60 * 60 * 48; // 48 hours
// Maps each token to a singleton MPMetrics instance
private static HashMap<String, MPMetrics> mInstanceMap = new HashMap<String, MPMetrics>();
+
+ private static String track_endpoint = "http://api.mixpanel.com/track?ip=1";
private Context mContext;
@@ -232,7 +232,7 @@ public void run() {
// Post the data
HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost(ENDPOINT_TRACK);
+ HttpPost httppost = new HttpPost(track_endpoint);
try {
// Add your data
@@ -287,4 +287,12 @@ public static MPMetrics getInstance(Context context, String token) {
return instance;
}
+
+ /**
+ * If you want to post events to your own custom endpoint.
+ * @param address the address where you want events sent to
+ */
+ public static void setTrackEndpoint(String address) {
+ MPMetrics.track_endpoint = address;
+ }
}

0 comments on commit 7f8c5fb

Please sign in to comment.