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.
You can track the events (For example: Install / Register / Sale) by using the following method.
import 'package:flutter_invitereferrals/flutter_invitereferrals.dart';
import 'package:flutter_invitereferrals/IRUserInfo.dart';
import 'package:flutter_invitereferrals/IREventInfo.dart';
IREventInfo eventInfo = new IREventInfo();
eventInfo.eventName = "eventName";
eventInfo.orderID = "orderID";
// OrderID parameter will be treated as userID in case of event name is "register"
eventInfo.purchaseValue = "199";
eventInfo.referrerCode= "referrerCode";
eventInfo.uniqueCode = "uniqueCode";
IRUserInfo userData = new IRUserInfo();
userData.name = "customer_name";
userData.email = "customer_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
Invitereferrals.shared.tracking(eventInfo, userData).then((value) => {
// do your task
});
Install Tracking
IREventInfo eventInfo = new IREventInfo();
eventInfo.eventName = "install";
Invitereferrals.shared.tracking(eventInfo, null);
Register Tracking
IREventInfo eventInfo = new IREventInfo();
eventInfo.eventName = "register";
eventInfo.orderID = "[email protected]"
// OrderID parameter will be treated as userID in case of event name is "register"
IRUserInfo userData = new IRUserInfo();
userData.name = "customer_name";
userData.email = "customer_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
Invitereferrals.shared.tracking(eventInfo, userData).then((value) => {
// do your task
});
Sale Tracking
IREventInfo eventInfo = new IREventInfo();
eventInfo.eventName = "sale";
eventInfo.orderID = "[email protected]";
eventInfo.purchaseValue = "199";
eventInfo.referrerCode = "";
eventInfo.uniqueCode = "";
IRUserInfo userData = new IRUserInfo();
userData.name = "customer_name";
userData.email = "customer_email";
userData.mobileNo = "01234567899";
userData.customValueOne = "value_1";
userData.customValueTwo = "value_2";
Invitereferrals.shared.tracking(eventInfo, userData);
Parameters
Parameter | Description | Value |
---|---|---|
Event_Name (String) | InviteReferrals provides events which you can pass in the code to track conversions and accordingly reward the customers. | sale, register, install, whatsapp, share |
orderID (String) | Order id or (userID for register event) of the customer | ABXHXXXX (for register tracking pass email / mobile) |
purchaseValue (String) | Total purchased amount of the event | 1000 |
email (String) | Customer's email id | [email protected] |
mobile (String) | Customer's mobile number | 9717XXXXXX |
name (String) | Name of the customer. | Mike |
referCode (String) [Optional] | referral code given by the referrer to his friend to make a sale so that he gets the incentive. | MARCXX or nil |
uniqueCode (String) [Optional] | unique code sent by the referrer to his friend to make a sale so that he gets the incentive. | ASDFXXX or nil |
isDebugMode (BOOL) | It works only for install event tracking if you app is in development mode then for testing make it true and If App is on App Store you must pass isDebugMode = NO or false in swift in install tracking. | true / false |
Tracking Callback will provide responses to either failure or success.
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 | |
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"}}} |
Note
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"
}
}
}
Updated about 2 months ago