Event Tracking

TRACKING EVENTS

InviteReferrals track at each and every step of the referral campaign from shares to clicks to conversions such as registrations, sales, mobile application installs. You can set up a webhook if you have your own API and you want data for different events to be sent on your server. You will receive the tracking callback responses to either success or failure. Read this informative guide to know the formats to track events.

Tracking Events

Implement the below method to track event(s):

​InviteReferralsApi.getInstance(this).tracking((String) eventName, String orderID, (int) purchaseValue, (String) referCode, (String) uniqueCode, (String) customValue, (JSONObject) userDataJson);

Parameters :

Parameter

Description

Value

Event name (string)

InviteReferrals provide events which you can pass in the code to track conversions and accordingly reward the customers.

sale, register, install, whatsapp, share

Order Id (integer)

order id of the customer

ABXHXXXXX

Purchase value (string)

Total purchased amount of the event

10000

Refer code (string)

referral code given by the referrer to his friend to make sale so that he gets the incentive.

MARCXX

Below are the examples for install/register/sale events. You can also implement custom events using these formats according to your requirements.

A. INSTALL

InviteReferralsApi.getInstance(this).tracking("install",​ ​null,​ ​0, null, null, null);

B. REGISTER

JSONObject jsonObject = new JSONObject();
try {
   jsonObject.put("name", name);
   jsonObject.put("email", email);
   jsonObject.put("mobile", mobile);
} catch (JSONException e) {
   e.printStackTrace();
}
InviteReferralsApi.getInstance(this).tracking("register",​ ​email,​ ​0, null, null, jsonObject);

C. SALE

InviteReferralsApi.getInstance(this).tracking("sale",​ “myOrder123”,​ ​999, null, null, null);

You can also get a tracking method response callback by implementing the below function :

InviteReferralsApi.getInstance(this).ir_TrackingCallbackListener(new IRTrackingCallback() {
   @Override
   public void ir_trackingCallbackForEventName(JSONObject tracking_response) {
   //do your work here
   }
});

Tracking Callback will provide responses to either failure or success.

In case of failure, you will get :

{
   "eventName":"register",
   "response":{
      "Authentication":"fail",
      "conversion_details":{
         "conversion":"fail",
         "Error":"Data not found",
         "ErrorType":"2"
      }
   }
}

In case of SUCCESS, you will get :

{
  "eventName":"register",
  "response":{
     "bid":"46287",
     "bid_e":"EF2B93611671E38CB40FCB460A07C46D",
     "Authentication":"success",
     "conversion_details":{
        "campaignID":"27894",
        "event":"register",
        "conversion":"success",
        "referrer_name":"Jack",
        "referrer_email":"[email protected]",
        "referrer_mobile":"0000000000",
        "referrer_email_org":"[email protected]",
        "referee_name":"Jack90",
        "referee_email":"[email protected]",
        "referee_mobile":"0000000099",
        "referee_android_id":"2cce7afd59743d9b",
        "referee_ios_ifa":"",
        "referee_email_org":"[email protected]",
        "orderID":"[email protected]",
        "purchaseValue":10,
        "order_custom_val":"",
        "ir_referrer_code":"MGB9Q7HR",
        "unique_code":""
     }
  }
}

In case of failure response, following are the error-type along with error-messages that are used in the callback.

Error Message

Error Type

Scenario

Note

Data not found

2

In case when data not found

Invalid Authentication

4

if something went wrong and the API authentication failed or network error

Invalid Account

5

In case of wrong account credential passed in AndroidManifest file (ie. BrandID and EncryptionKey)

Conversion not eligible

6

In case a referrer is not found, that means the referral link was not clicked if the referrer shared the referral link. OR In case of referrerCode /uniqueCode the value for referrerCode / unique code is either nil or invalid

Parameter missing

7

Parameter missing, orderID or eventName cannot be empty or null

In case of Event name is null or empty, in callback response "eventName" key will not appear.

Example : {"response":{"Authentication":"fail","conversion_details":{"conversion":"fail","Error":"Parameter missing, orderID or eventName cannot be empty or null","ErrorType":"7"}}}

install already tracked or not eligible

9

In case of Event name is null or empty, in callback response "eventName" key will not appear.

Example : {"response":{"Authentication":"fail","conversion_details":{"conversion":"fail","Error":"Parameter missing, orderID or eventName cannot be empty or null","ErrorType":"7"}}}

Track Invite

Implement this function for manual invites. Manual invites occur when the referrer directly enters all the details of the referred such as email, mobile and other details in the form.

InviteReferralsApi.getInstance(context).trackInvite(String sourceName);

‘sourceName’ parameter will be as per the app name.

Below are the details-

App Name

Source Name

Whatsapp

whatsapp

Gmail

Email

Messenger

messenger or fbmessage

Facebook

facebook or fbshare

Twitter

tweet or twitter

Linked in

linkedin

SMS

sms

Pinterest

pinterest

Telegram

telegram

Referral Link

referral_link_invites_app