1. Home
  2. Integrations
  3. Android Native Events Setup Guide
  4. Custom Events Setup – Android

Custom Events Setup – Android

We recommend using our pre-defined events but in case you wish to define a custom event to track a specific behavior.

You will need to call the below method of MTractionEventTracker Class to track the custom event in your Application.

Public static void trackCustomEvent(Context context, CustomEvent customEvent);
// Custom Event Constructor Call
CustomEvent customEvent= new CustomEvent(eventName);

  • Mandatory parameters (Custom Event): 
    • Event Name – Event name going to be tracked
  • Optional parameters (Custom Event):
    • Key – Key name for tracked custom event
    • Value – Value of key for tracked custom event

Sample Code

// Example Constructor Call with the mandatory parameters
CustomEvent customEvent = new CustomEvent(“Job Search”);

// Examples for other parameters passed with the event (These are optional)
customEvent.setCustomKVP(“JobId”,10234)
  .setCustomKVP(“JobType”,“Technical”)
  .setCustomKVP(“JobProfile”,“Manager”);
  
// trackCustomEvent method call
MTractionEventTracker.trackCustomEvent(this.getApplicationContext(), customEvent);
Was this article helpful to you? Yes No

How can we help?