Netmera Event

NetmeraEvent class provides a simple to use interface for tracking users’ behaviors during application usage.

Netmera SDK tracks following events internally:

App Installation Events

This event will be sent automatically when your app installed on a device. It is used to track number of your users.

Activity Start (App Open) Events

Activity Start (App Open) events allow you to track your application being launched. By adding the following line to the onStart() method of all of your activity classes, you’ll begin to collect data when and how often your application is opened, how many time do your users spend in the app.

If you add activity start event, please add activity stop event also.

NetmeraEvent.onStart(this);
Activity Stop (App Close) Events

Activity Stop (App Close) events allow you to track your application closed. By adding the following line to the onStop() method of all of your activity classes, you’ll begin to collect data when and how often your application is closed. If you add activity stop event, please add activity start event also.

NetmeraEvent.onStop(this);

***Activity start and activity stop events should be added all of the activities except push activity in an app if push activity extends NetmeraActivity. If it does not extend, you must add onStart and onStop events to the push activity class.

 Time In App Events

This event type is for tracking time in application data. When you call the app close event, this event will be sent automatically if you add open and close events.

 Push Notification Clicked Events
  • If your push activity extends NetmeraActivity, this event will automatically be sent. You don’t need to do anything.

  • If not, in your push activity, you need to add onStart() and onStop() methods.

  • If you want to finish your Activity in onCreate or before onStart or if you use your custom activity which does not extend NetmeraActivity, you need to call following before finishing your Activity. You must add the following to onCreate() method of your Push Activity.

NetmeraEvent.sendPushClickedEvent(getIntent());

It will be checked if user clicked push and show if there is any incoming push. If there is no push message incoming, the method does nothing.

If your push activity does not extend NetmeraActivity, you need to add Activity Start and Activity Stop events explained above.

User Location Changed Events

This event will be sent automatically to Netmera with user location info if your app has ACCESS_COARSE_LOCATION permission. It uses coarse location. Otherwise, these event data can’t be collected.

App Exception Events

This event will be sent if there is any exception thrown by your app and if it is unhandled. Unhandled exception data will be sent automatically to Netmera. If you want, you can send your handled exceptions to Netmera. Click here to learn how.

Custom Events

Netmera allows you to create custom events and track different behaviors of users. By adding the following line of code to your app code, you can send your own events. When you want to create new segments or send event related pop-ups, you can use these events. Your event name will appear on the segment list when you want to create a new one.

String eventName = "Your custom event name";
try {
    NetmeraEvent.sendCustomEvent(eventName);
} catch (NetmeraException e) {
    // Handle exception
}
Custom Events With Key – Single Value

Netmera allows you to send data with your custom event. The data can be used while creating segments and triggered push notification to target deeply.

String eventName = "Your custom event name";
JSONObject data = null;
try {
    data = new JSONObject();
    data.put("event data key 1", "event data 1");
    data.put("event data key 2", "event data 2");
} catch(JSONException e) {
    // Handle exception
}
try {
    NetmeraEvent.sendCustomEventWithData(eventName, data);
} catch (NetmeraException e) {
    // Handle exception
}
Custom Events With Key-Multiple Values

Similar to previous example, you can also put JSONArray as a value. This could be used for the cases which a key requires multiple values. While you are creating a segment from Netmera Panel, this values could be selected one by one. (example: selecting just “News” as a value).

String eventName = "Your custom event name";
JSONObject data = null;
JSONArray multipleValues = null;

try {
    data = new JSONObject();
    multipleValues = new JSONArray();
    multipleValues.put("News");
    multipleValues.put("Sports");
    data.put("category", multipleValues);   // multiple values
    } catch(JSONException e) {
            // Handle exception
    }
    try {
        NetmeraEvent.sendCustomEventWithData(eventName, data);
    } catch (NetmeraException e) {
            // Handle exception
    }

March 31, 2015 / parag

Recent Blog Posts
ROI based app marketing for your business
App Indexing: some insights
Categories