SDK

Analytics

In this page we will show you how you can quickly track events in your app. This can be extremely useful if you want to measure certain views, usage of certain features or pretty much anything in your app.

If you wish to visualize the data generated by these events, you can subscribe the Reports add-on feature of Notificare. This feature will allow you to create time series charts where we break down these metrics for you.

In your app you simply need to invoke the following method, whenever you want to measure something:

Notificare.shared().getEventLogger().logCustomEvent("LOGINVIEW", new NotificareCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean aBoolean) {
        Log.i(TAG, "Event sent");
    }

    @Override
    public void onError(NotificareError notificareError) {
        Log.e(TAG, "Error sending event");
    }
});

This would created an event of type re.notifica.event.custom.LOGINVIEW.

Additionally, you can also store more data with your events by simply include it whenever you register the event:

HashMap<String, Object> data =  new HashMap<String, Object>();
data.put("aKey", "aValue");

Notificare.shared().getEventLogger().logCustomEvent("MYEVENT", data, new NotificareCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean aBoolean) {
        Log.i(TAG, "Event sent");
    }

    @Override
    public void onError(NotificareError notificareError) {
        Log.e(TAG, "Error sending event");
    }
});

The event data can also be a JSON object

JSONObject data =  new JSONObject();
data.put("aKey", "aValue");

Notificare.shared().getEventLogger().logCustomEvent("MYEVENT", data, new NotificareCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean aBoolean) {
        Log.i(TAG, "Event sent");
    }

    @Override
    public void onError(NotificareError notificareError) {
        Log.e(TAG, "Error sending event");
    }
});