Documents

Overview


AdGyde is a Mobile Application Attribution tool which helps application owners / marketers in better advertisement targeting and in optimizing the ad expenditure.

Attribution
AdGyde through its attribution SDK can determine which channel / partner the app install was delivered through. Post install events, User Flow and how the application is being used is shown by AdGyde. This data can help advertiser / Application owner to specifically target user segments, find out best channel to improve upon ROI.

To get started contact AdGyde support - support@adgyde.com

To start integration, please check
  1. Integrate Android SDK
  2. Integrate Unity SDK
  3. Integrate Cordova SDK

Integration Process



1. Get your App Key
Sign-in to your AdGyde Console, the credentials would have already been provided by AdGyde support team. In case you have not yet received the same, please contact the AdGyde Support Team.

Please follow the given steps :-
Step 1 - Visit the AdGyde Website - https://www.adgyde.com
Step 2 - Go to console
Step 3 - Sign-in with your credentials
Step 4 - Go to Setup -> Applications from the menu option
Step 5 - Click on "Create an application" option on Top Right corner
Step 6 - Fill in the Application Name and Package Name
Step 7 - Note down the App Key for integration reference

2. Download Android SDK
Please download the SDK from "Download SDK" link in top right corner of AdGyde Console.



Integrate the downloaded SDK using the below steps


3. Integrate SDK into project

3.1 Add library files into your project
  • Unzip AdGyde Android SDK
  • Add ADGYDE_ANDROID_SDK *.aar file to your android project

3.2 Follow below steps to import .aar file into your projects
  • Go to File>New>New Module
  • Select "Import .JAR/.AAR Package" and click next.
  • Enter the path to .aar file and click finish.
  • Go to File>Project Structure (Ctrl + Shift + Alt + S).
  • Under "Modules," in left menu, select "app."
  • Go to "Dependencies tab.
  • Click the green "+" in the upper right corner.
  • Select "Module Dependency"
  • Select the ADGYDE_ANDROID_SDK .AAR file from the list.

3.3 Initializing AdGyde
Android SDK needs to be initialized in the application. Please check Example project on Android SDK for complete code.

package com.adgyde.example;

import android.app.Application;
import android.util.Log;
import com.adgyde.android.AdGyde;

public class ExampleApplication extends Application implements
Constants {
@Override

public void onCreate() {
super.onCreate();

Log.d(TAG, "ExampleApplication.onCreate()");
// Default channel is Organic
AdGyde.init(this, "Your Appkey", "Organic");

AdGyde.setDebugEnabled(true);
}
}

Please don't initialize the AdGyde SDK on Main Activity, this will result in incorrect session data.

Request you to create a separate application class or use any application class already present in your project. For New application class - create ExampleApplication.java and add the details under application tag in AndroidManifest.xml.

<application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name= "com.adgyde.example.ExampleApplication">

<!- application configuration items -->

</application>

Value of android:name parameter should be full name of the newly created application class as shown in the above code snippet

3.4 Pass IMEI to AdGyde
If the application needs to pass the IMEI and record the same along with other user details, then Android SDK needs to be given permission to pick up IMEI explicitly. Even when application has the permission, AdGyde SDK doesn't pick up IMEI without App developer consent which user needs to pass to the SDK using AdGyde.allowPermissionIMEI(context , true) function

Along with above permission make sure application itself has the permission to pick up IMEI. Add Phone state permission in your applications manifest.xml file

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Below is the sample code to initialize Android SDK with App Developer consent to pass IMEI
package com.adgyde.example;

import android.app.Application;
import android.util.Log;
import com.adgyde.android.AdGyde;

public class ExampleApplication extends Application implements
Constants {
@Override

public void onCreate() {
super.onCreate();

Log.d(TAG, "ExampleApplication.onCreate()");
AdGyde.allowPermissionIMEI(this, true);
AdGyde.init(this, "Your Appkey", "Organic"); // Default channel is Organic

AdGyde.setDebugEnabled(true);
}
}

3.5 Embed Google Play Services into Your App
Install the Google Play Services SDK and import it into your project. For download details, Click here.
Add the below code / entry to the AndroidManifest.xml as the last entry in the application tag (Just before </application>)

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

NOTE:
AdGyde recommends to always use the latest version of Google play service.

For more details see the link below.
https://developer.android.com/google/play-services/setup.html

Please refer below code

< application
android:name=".ExampleApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />


<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" \>
</intent-filter>
</activity>

<service android:name="com.adgyde.android.AppJobService"android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE">
</service>


3.6 Add Install receiver code in the androidmanifest.xml

Note:
Please make sure that following receiver tag is kept inside application tag.

<receiver android:name="com.adgyde.android.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If an application uses multiple INSTALL_REFERRER receivers, you should use com.adgyde.android.MultiInstallReceiver instead of com.adgyde.android.InstallReceiver.
MultiInstallReceiver MUST be the first receiver on Top of all the other INSTALL_REFERRER receivers

<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If you want to use multiple receivers, then the Manifest.xml file should look like this:

<!--The AdGyde Install Receiver should be placed first and it will broadcast to all receivers placed below it -->
<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<!--All other receivers should be followed right after -->
<receiver android:name="com.google.android.abc.AbcReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<receiver android:name="com.adsmobi.android.xyz.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>


3.7 Add permissions to project
Add following permissions to AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
</usespermission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>


3.8 Add dependency to project
Add the following dependency to Android gradle file (Module : android).

dependencies {
// . . .
compile 'com.android.installreferrer:installreferrer:1.0'
// . . .
}


4. Sessions
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application.

In AdGyde Android SDK, sessions are linked to the android application Life Cycle and so are calculated automatically without any integration.

5. User Flow
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

In AdGyde Android SDK, User Flow is linked to the android application Life Cycle and so is calculated automatically without any integration.

6. Uninstall Tracking
AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

Un-Install detailed integration process

7. Events
AdGyde's Event Tracking allows an application owner to track the events triggered by users. What user is doing in your application are generally tracked using the events like - Registration, Add to Cart, Payment initiated, Payment.
AdGyde supports multiple types of events, please follow the below link to integrate events in your application

Events detailed integration process

8. Deep Linking
Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

Deep Linking detailed integration process

9. Demography
AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively.

Demography detailed integration process

10. Pass additional data to SDK
AdGyde allows to pass additional data like Userid, Email and Phone Number to SDK so that same can be correlated to the AdGyde Data and logs.

  • Advertiser's User id
    In case Advertiser needs to relate Applications analytics data with its own User Id then advertiser can pass the same explicitly using AdGyde.setClientUserId("ADG1045984") function. Analytical data then can be shared with the install, events etc. Userid wise also.

  • Email id
    In case Advertiser needs to store and relate Application analytics data with the users email id then advertiser can pass the same explicitly using AdGyde.setEmail(context, "support@adgyde.com") function. Analytical data then can be shared along with email id

  • Phone Number
    In case Advertiser needs to store and relate Application analytics data with the users phone number then advertiser can pass the same explicitly using AdGyde.setPhoneno(context, "919876543210") function. Analytical data then can be shared along with phone number

public void onClick(View view)
{
/*
* User Id
* =============
* In case Advertiser needs to store and relate Application analytics data with the Advertisers user id then advertiser
* can pass the same explicitly using AdGyde.setClientUserId("ADG1045984") function.
* Analytical data then can be shared along with User id
*/

AdGyde.setClientUserId("ADG1045984");

/*
* Email Id
* =============
* In case Advertiser needs to store and relate Application analytics data with the users email id then advertiser
* can pass the same explicitly using AdGyde.setEmail(context, "support@adgyde.com") function.
* Analytical data then can be shared along with email id
*/

AdGyde.setEmail(context, "support@adgyde.com");

/*
* Phone Number
* =============
* In case Advertiser needs to store and relate Application analytics data with the users phone number then advertiser
* can pass the same explicitly using AdGyde.setPhoneno(context, "919876543210") function.
* Analytical data then can be shared along with phone number
*/

AdGyde.setPhoneno(context, "919876543210");
}


1. Get your App Key
Sign-in to your AdGyde Console, the credentials would have already been provided by AdGyde support team. In case you have not yet received the same, please contact the AdGyde Support Team.

Please follow the given steps :-
Step 1 - Visit the AdGyde Website - https://www.adgyde.com
Step 2 - Go to console
Step 3 - Sign-in with your credentials
Step 4 - Go to Setup -> Applications from the menu option
Step 5 - Click on "Create an application" option on Top Right corner
Step 6 - Fill in the Application Name and Package Name
Step 7 - Note down the App Key for integration reference

2. Download Unity SDK
Please download the SDK from "Download SDK" link in top right corner of AdGyde Console.



Integrate the downloaded SDK using the below steps


3. Integrate SDK into project

3.1 Add library files into your project
  • Unzip AdGyde Android Unity SDK
  • Add ADGYDE_ANDROID_Unity_SDK file to your Unity project

3.2 Follow below steps to import .aar file into your projects
  • Open Unity Project and switch platform to Android
  • Click Assets —> Import Package —> Custom Package (Adgyde Unity Package)
  • Select All files in import window and click import
  • Create an empty game object in Hierarchy tab
  • Add the AdgydeDemo.cs file to the empty game object

3.3 Initializing AdGyde
Android Unity SDK needs to be initialized in your main Script. Please check Example project on Android Unity SDK for complete code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Sample_UI_Class : MonoBehaviour {
private static Sample_UI_Class _instance = null;

public static Sample_UI_Class SharedInstance {
get {
// if the instance hasn’t been assigned then search for it
if (_instance == null) {
_instance = GameObject.FindObjectOfType(typeof(Sample_UI_Class)) as Sample_UI_Class;
}

return _instance;
}
}

public Text DebugLog;

void Awake(){
AdgydeManager.SharedInstance.Adgyde_Init();
// initialized AdGyde
}

3.4 Pass IMEI to AdGyde
If the application needs to pass the IMEI and record the same along with other user details, then Android SDK needs to be given permission to pick up IMEI explicitly. Even when application has the permission, AdGyde SDK doesn't pick up IMEI without App developer consent which user needs to pass to the SDK using AdgydeManager.SharedInstance.OnImeiPermission(true) function

Along with above permission make sure application itself has the permission to pick up IMEI. Add Phone state permission in your applications manifest.xml file
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Below is the sample code to initialize Android SDK with App Developer consent to pass IMEI

void Awake() {
// initialized AdGyde
AdgydeManager.SharedInstance.Adgyde_Init("Your_App_Key", "Organic");
// Set IMEI sharing Consent
AdgydeManager.SharedInstance.OnImeiPermission(true);

// Set Current Screen
AdgydeManager.SharedInstance.setCurrentScreen("Home_Page"); //Custom User Flow
// get Deep Link Data
AdgydeManager.SharedInstance.getDeeplinkDataURl();
}

3.5 Embed Google Play Services into Your App
Install the Google Play Services SDK and import it into your project. For download details, Click here.
Add the below code / entry to the AndroidManifest.xml as the last entry in the application tag (Just before </application>)

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>

NOTE:
AdGyde recommends to always use the latest version of google play service.

For more details see the link below.
https://developer.android.com/google/play-services/setup.html

Please refer below code

< application
android:icon="@drawable/app_icon"
android:label="@string/app_name">

<activity android:name="com.google.firebase.MessagingUnityPlayerActivity"
android:label="@string/app_name"
android:icon="@drawable/app_icon"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|
screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>

<service android:name="com.google.firebase.messaging.MessageForwardingService"
android:exported="false"/>

<service
android:name="com.adgyde.android.AppJobService" android:exported="true" android:permission="android.permission.BIND_JOB_SERVICE" />
</application>


3.6 Add Install receiver code in the androidmanifest.xml

Note:
Please make sure that following receiver tag is kept inside application tag.

<receiver android:name="com.adgyde.android.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If an application uses multiple INSTALL_REFERRER receivers, you should use com.adgyde.android.MultiInstallReceiver instead of com.adgyde.android.InstallReceiver.
MultiInstallReceiver MUST be the first receiver on Top of all the other INSTALL_REFERRER receivers

<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If you want to use multiple receivers, then the Manifest.xml file should look like this:

<!--The AdGyde Install Receiver should be placed first and it will broadcast to all receivers placed below it -->
<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<!--All other receivers should be followed right after -->
<receiver android:name="com.google.android.abc.AbcReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<receiver android:name="com.adsmobi.android.xyz.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>


3.7 Add permissions to project
Add following permissions to AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
</usespermission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>


3.8 Add dependency to project
Add the following dependency to Android gradle file (Module : android).

dependencies {
// . . .
compile 'com.android.installreferrer:installreferrer:1.0'
// . . .
}


4. Sessions
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. AdGyde helps to track the sessions of the application, session duration and time spent by user on application.

Sessions Detailed Integration Process

5. User Flow
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

User Flow Detailed Integration Process

6. Uninstall Tracking
AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

Un-Install Detailed Integration Process

7. Events
AdGyde's Event Tracking allows an application owner to track the events triggered by users. What user is doing in your application are generally tracked using the events like - Registration, Add to Cart, Payment initiated, Payment.
AdGyde supports multiple types of events, please follow the below link to integrate events in your application

Events detailed integration process

8. Deep Linking
Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

Deep Linking Detailed Integration Process

9. Demography
AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively.

Demography detailed integration process

10. Pass additional data to SDK
AdGyde allows to pass addition data like Userid to SDK so that same can be correlated to the AdGyde Data and logs.

  • Advertiser's User id
    In case Advertiser needs to relate AdGyde data and logs with its own User Id then advertiser can pass the same to AdGyde SDK explicitly using AdgydeManager.SharedInstance.SetUserId("ADG1045984") function. Once passed AdGyde will be able to share the install, events etc Userid wise also.



1. Get your App Key
Sign-in to your AdGyde Console, the credentials would have already been provided by AdGyde support team. In case you have not yet received the same, please contact the AdGyde Support Team.

Please follow the given steps :-
Step 1 - Visit the AdGyde Website - https://www.adgyde.com
Step 2 - Go to console
Step 3 - Sign-in with your credentials
Step 4 - Go to Setup -> Applications from the menu option
Step 5 - Click on "Create an application" option on Top Right corner
Step 6 - Fill in the Application Name and Package Name
Step 7 - Note down the App Key for integration reference

2. Download Cordova SDK
Please download the SDK from "Download SDK" link in top right corner of AdGyde Console.



Integrate the downloaded SDK using the below steps


3. Integrate SDK into project

3.1 Add library files into your project
  • Unzip AdGyde Android Cordova Plugin
  • Put the AdGyde Android Plugin file into your plugin folder

3.2 Follow below steps to import plugin into your project
  • Open Cordova Project and switch platform to Android
  • Use "Cordova prepare" command for adding plugin into your platform.

3.3 Initializing AdGyde
Android Cordova plugin needs to be initialized in your application. Please check Example project on Android Cordova Plugin for complete code.

document.addEventListener("deviceready", function(){
// AdGyde Initialise
// Initialize AdGyde SDK with appkey & default channel id "Organic".
// When application is installed from Google Play Store without any campaign the Channel will be Organic as specified in Init Function
// In case the application is installed through a campaign link then the Default channel will be overridden and value from the campaign link will be passed.

AdGydeTracker.initAdGyde("Your App key","Organic");
});

3.4 Pass IMEI to AdGyde
If the application needs to pass the IMEI and record the same along with other user details, then Android SDK needs to be given permission to pick up IMEI explicitly. Even when application has the permission, AdGyde SDK doesn't pick up IMEI without App developer consent which user needs to pass to the SDK using AdGydeTracker.onAllowIMEI(true) function

Along with above permission make sure application itself has the permission to pick up IMEI. Add Phone state permission in your applications manifest.xml file
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Below is the sample code to initialize Android SDK with App Developer consent to pass IMEI

document.addEventListener("deviceready", function(){
// AdGyde Initialise
// Initialize AdGyde SDK with appkey & default channel id "Organic".
// When application is installed from Google Play Store without any campaign the Channel will be Organic as specified in Init Function
// In case the application is installed through a campaign link then the Default channel will be overridden and value from the campaign link will be passed.
AdGydeTracker.initAdGyde("Your App key","Organic");

//Permission for Collecting IMEI
AdGydeTracker.onAllowIMEI(true);

// Custom User Flow
AdGydeTracker.setCurrentScreen("Home_page");
// FCM token method call
onFcmToken();
});



3.5 Add Install receiver code in the androidmanifest.xml

Note:
Please make sure that following receiver tag is kept inside application tag.

<receiver android:name="com.adgyde.android.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If an application uses multiple INSTALL_REFERRER receivers, you should use com.adgyde.android.MultiInstallReceiver instead of com.adgyde.android.InstallReceiver.
MultiInstallReceiver MUST be the first receiver on Top of all the other INSTALL_REFERRER receivers

<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

If you want to use multiple receivers, then the Manifest.xml file should look like this:

<!--The AdGyde Install Receiver should be placed first and it will broadcast to all receivers placed below it -->
<receiver android:name="com.adgyde.android.MultiInstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<!--All other receivers should be followed right after -->
<receiver android:name="com.google.android.abc.AbcReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<receiver android:name="com.adsmobi.android.xyz.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>


3.6 Add permissions to project
Add following permissions to AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
</usespermission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>


3.7 Add dependency to project
Add the following dependency to Android gradle file (Module : android).

dependencies {
// . . .
compile 'com.android.installreferrer:installreferrer:1.0'
// . . .
}


4. Sessions
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. AdGyde helps to track the sessions of the application, session duration and time spent by user on application.

Sessions Detailed Integration Process

5. User Flow
'User Flow' allows the Application Developer to gauge the movement of its users through the activities / Page defined in the application. By analysing the user flow Sankey diagram, the App developer can predict which activity / page is most popular among its users and where the drop-off rates are high.

User Flow Detailed Integration Process

6. Uninstall Tracking
AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

Un-Install Detailed Integration Process

7. Events
AdGyde's Event Tracking allows an application owner to track the events triggered by users. What user is doing in your application are generally tracked using the events like - Registration, Add to Cart, Payment initiated, Payment.
AdGyde supports multiple types of events, please follow the below link to integrate events in your application

Events detailed integration process

8. Deep Linking
Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

Deep Linking Detailed Integration Process

9. Demography
AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively.

Demography detailed integration process

10. Pass additional data to SDK
AdGyde allows to pass addition data like Userid to SDK so that same can be correlated to the AdGyde Data and logs.

  • Advertiser's User id
    In case Advertiser needs to relate AdGyde data and logs with its own User Id then advertiser can pass the same to AdGyde SDK explicitly using AdGydeTracker.SetUserId("ADG1045984") function. Once passed AdGyde will be able to share the install, events etc Userid wise also.




Acquisition


New Users
AdGyde lets you know, how many users installed your application through various campaigns in real time. Through this feature you are able to compare the performance of your campaigns and analyze the traffic for your applications.

Organic v/s Non-organic Downloads
AdGyde provides segregated data for Organic and Non-Organic downloads
Organic App download: An organic download is a type of download wherein the user has reached to your application on Play Store searching through keywords provide by you.
Non-organic app download: An non-organic install is one where the user has come to your app download page for a reason, they may have been recommended by a friend or they have seen some form of promotion of your app. Somebody has directed the user to your application

User Flow
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

User Flow in detail

Uninstall Tracking
AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application.

Un-Install tracking in detail

Re-Attribution
Reattribution is the attribution of a re-install to a partner who has re-acquired the user using a new campaign. When a user is re-acquired from a New Channel then it can be termed as re-attribution but the credit for same is not given to New Channel.

Credit of re-attribution of a user is given to new campaign when the same was done using re-attribution campaign.

New User per Publisher
If an advertiser, partner wants to track the sub-publishers of the new users, they can pass the sub-publisher value in the campaign link ands same will be reflected under the graph.

Example : http://log2.adgyde.com/intf/b/1/u?c=20180605702947&p=1046&clickid={clickid}&pub={Publisher}

Returning Users
1. Overview
Returning back to the application is an index to measure user loyalty.

For applications - Weekly returning rate to measure application performance would be the expected criteria. E.g. For an online bookshop, we expect user should open application at least once weekly. If online bookshop got 100 new users today, and 60 users open the application at least once in this week, then weekly returning rate is 60%. It can be considered good for an online bookshop.

For games - The returning rate of +1 day should be more important than weekly returning rate. This is because the developer expects the user should be attracted to their game and should play the game day and night. If the user doesn’t play the game the next day, this signifies that user has not like the game and the user could be lost.

2. Definition of returning
In Below Depiction +n specifies number of days since Install. Assuming the number of New Users on Apr 1, 2016 was 100. +1 would mean Apr 2, 2016 and Users on +1 mean that How many users who installed application on Day 0 (Apr 1, 2016) have again returned on / opened the application on +1 (Apr 2, 2016). Similarly, +2 means Apr 3, 2016 and users on +2 mean that How many users who installed application on Day 0 (Apr 1, 2016) have again returned on / opened the application on +2 (Apr 3, 2016).

  Date Count of Active Users
(Out of New Users of 1st Apr)
Count of returning users
  Apr 1, 2016 100 (New Users)  
+1 Apr 2, 2016 5 =5
+2 Apr 3, 2016 10 =distinct(5, 10)
+3 Apr 4, 2016 15 =distinct(5, 10, 15)
+4 Apr 5, 2016 20 =distinct(5, 10, 15, 20)
+5 Apr 6, 2016 25 =distinct(5, 10, 15, 20, 25)
+6 Apr 7, 2016 30 =distinct(5, 10, 15, 20, 25, 30)
+7 Apr 8, 2016 35 =distinct(5, 10, 15, 20, 25, 30, 35)
+14 Apr 15, 2016 40 =distinct(5, 10, 15, 20, 25, 30, 35, 40)
+30 May 1, 2016 45 =distinct(5, 10, 15, 20, 25, 30, 35, 40, 45)


On Apr 2, 2016, 5 out of 100 new users opened the application, the number of returning users is 5. From Apr 2, 2016 to Apr 3, 2016, total 15 users opened the application, system will remove duplicate users, so number of returning users will be distinct(5, 10).

Note : This data in real life is descending as number of users returning decrease as the days pass.

3. How to read report
Returning User data is NOT processed on real time and can take up to 24 Hours to show in Console.
1. Login to AdGyde console
2. Select Returning Users section from Acquisition heading in left navigation menu



Audience


Active Users
AdGyde tells you the number of users which have opened the application at least once on a given day and this number is shown in real time.

Geo Location
AdGyde provides the number of new users state wise so that you can target your campaign where there is more potential.

Session
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application.

Read Sessions in detail

Average Session Duration
A session starts with application start and it ends after the user has quit the application, the time between the session start and session end is session duration. Each session of user is of different duration and can be multiple sessions in a day. The Session Duration Average is calculated by taking each session separately rather than user wise.

Average session duration can help advertisers find out how soon the user exits the application and how engaged he feels with the application.

Demography
AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively.

Demography in detail

Events
Event is a powerful tool to track interaction between user and mobile application. These are used to track the registration, purchase in application and these events can be clubbed with postbacks to create KPI for campaigns

Events in detail

Conversion Funnels
Conversion Funnel is a way to measure the user path as per the user interaction with the application. It is a powerful tool to track user reactions against designed service path.

Conversion Funnel in detail


Demography



AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively. Campaigns can be run, keeping in mind that the application is say - majorly used by Females and 26-35 Age group, so Advertiser can ask a publisher to target only these groups and get maximum installs and return on the cost spent.

For Age Profile
The user age profile demography shows the advertiser the user segregation and user concentration on specific age segments. Having this data assists app marketer to take more accurate measurements and helps in decision making.

Data can be passed to SDK by following 2 functions
  1. AdGyde.setAge(Context context, int years, int month, int day);
  2. AdGyde.setAge(Context context, int age);

// Age to be calculated from Year, Month, Day
AdGyde.setAge(context, 1991, 05, 03);

// Age Value
AdGyde.setAge(context, 32);





For Gender Profile
The User gender profile demography shows the advertiser the user segregation and user concentration on specific Gender segments. Having this data, assists app marketer to take more accurate measurements and helps in decision making.

Syntax : AdGyde.setGender(Context context , String gender);

Values which are permitted in Function
  1. Male (M)
  2. Female (F)
  3. Others (O)

// when you pass string for Male
AdGyde.setGender(context, AdGyde.M);

// when you pass string for Female
AdGyde.setGender(context, AdGyde.F);

// when you pass string for Others
AdGyde.setGender(context, AdGyde.O);





AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively. Campaigns can be run, keeping in mind that the application is say - majorly used by Females and 26-35 Age group, so Advertiser can ask a publisher to target only these groups and get maximum installs and return on the cost spent.

For Age Profile
The user age profile demography shows the advertiser the user segregation and user concentration on specific age segments. Having this data assists app marketer to take more accurate measurements and helps in decision making.

Data can be passed to SDK by following 2 functions
  1. AdgydeManager.SharedInstance.OnsetAge(int years, int month, int day);
  2. AdgydeManager.SharedInstance.OnsetAge(int age);

// Age to be calculated from Year, Month, Day
AdgydeManager.SharedInstance.OnsetAge(1991, 05, 03);

// Age Value
AdgydeManager.SharedInstance.OnsetAge(32);





For Gender Profile
The User gender profile demography shows the advertiser the user segregation and user concentration on specific Gender segments. Having this data, assists app marketer to take more accurate measurements and helps in decision making.

Syntax : AdgydeManager.SharedInstance.OnsetGender(String gender);

Values which are permitted in Function
  1. Male (M)
  2. Female (F)
  3. Others (O)

// when you pass string for Male
AdgydeManager.SharedInstance.OnsetGender("M");

// when you pass string for Female
AdgydeManager.SharedInstance.OnsetGender("F");

// when you pass string for Others
AdgydeManager.SharedInstance.OnsetGender("O");





AdGyde demography data provides details of Age and Gender wise segregation of User, this can be used by Advertiser to target the new users and run their campaigns effectively. Campaigns can be run, keeping in mind that the application is say - majorly used by Females and 26-35 Age group, so Advertiser can ask a publisher to target only these groups and get maximum installs and return on the cost spent.

For Age Profile
The user age profile demography shows the advertiser the user segregation and user concentration on specific age segments. Having this data assists app marketer to take more accurate measurements and helps in decision making.

Data can be passed to SDK by following 2 functions
  1. AdGydeTracker.setAge(int years, int month, int day);
  2. AdGydeTracker.setAge(int age);

// Age to be calculated from Year, Month, Day
AdGydeTracker.setAge(1991, 05, 03);

// Age Value
AdGydeTracker.setAge(32);





For Gender Profile
The User gender profile demography shows the advertiser the user segregation and user concentration on specific Gender segments. Having this data, assists app marketer to take more accurate measurements and helps in decision making.

Syntax : AdGydeTracker.setGender(String gender);

Values which are permitted in Function
  1. Male (M)
  2. Female (F)
  3. Others (O)

// when you pass string for Male
AdGydeTracker.setGender(AdGydeTracker.M);

// when you pass string for Female
AdGydeTracker.setGender(AdGydeTracker.F);

// when you pass string for Others
AdGydeTracker.setGender(AdGydeTracker.O);






Conversion Funnel


Conversion Funnel is a way to measure the user path as per the user interaction with the application. It is a powerful tool to track user reactions against designed service path.

1. Overview


Suppose a banner is shown on the home page of a news application. Expectation is users will be attracted to click the banner which will navigate the user to local news. There is a contact link at the bottom of this news. Payment will be based on local news thread, so we expect users to willing click and establish contact through the form.

In practice, 100 users entered home page out of these 40 users click on banner then out of these 40 users only 10 users read news and click contact link. The convert rate is 10%.

2. Setup Events
Events need to be setup in Console before the events are tracked to create the funnel

Please follow the below instructions to setup an Event
  1. Login to AdGyde console
  2. Click on 'Setup' -> 'Events'
  3. Click on 'Create an event' button to create a new event
  4. Select application and input event name
  5. Select Type - Simple Event
  6. No Need to Enter Parameter name
  7. Click on 'Create' button
Below values are used for this example
Event 1
  1. Name :- EnterHomePage
  2. Type :- Simple Event
  3. Parameter Name :- No Need
Event 2
  1. Name :- BannerClicked
  2. Type :- Simple Event
  3. Parameter Name :- No Need
Event 3
  1. Name :- ContactUs
  2. Type :- Simple Event
  3. Parameter Name :- No Need

3. Code for tracking events
/**
* Invoked when user launch my application.
*/
public void onEnterHomePage() {
AdGyde.onEvent( "EnterHomePage");
}

/**
* Invoked when user click on home page banner.
*/
public void onBannerClicked() {
AdGyde.onEvent( "BannerClicked");
}

/**
* Invoked when user click on "contract us" link.
*/
public void onContractUsViewed() {
AdGyde.onEvent("ContactUs");
}


4. Setup funnel
After the coding part is complete, funnel needs to be setup in the console as well.

Please follow the below instructions to setup a funnel
  1. Login to AdGyde console
  2. Click on 'Setup' -> 'Event Funnel'
  3. Click on 'Create an event Funnel' button to create a new funnel
  4. Select application and input funnel name
  5. Select the events one by one EnterHomePage, BannerClicked, ContactUs
  6. Click on 'Create' button to save funnel
Note: Data population in the funnel takes at around 24 Hours after the funnel has been created.




Funnel plots the conversion rate in visual form for each step.

Postback (S2S) Macros


Macros supported in Install postback (S2S)
An advance feature of AdGyde, post-back URL provides server to server notification for every new user installed and In-App events.

Below is the list of Macros supported in Install post back
MacrosCommentExample
{clickid}Unique Value sent by the partnertestdclick12
{advertisingId}Google Advertising Id of the usere23c04c6-44aa-48fc-9781-xxxxxxxxxxxx
{androidId}Android Id of the application35aa72a37cxxxxxx
{idfa}Currently will be null as we do not capture any idfa value
{pub}Value of the sub-publisher can be passed for install segregation123 / ABC
{sub1}Exact value which was set by Partner in Tracking URL macro sub1={sub1} will be returnedCutomMacro1
{sub2}Exact value which was set by Partner in Tracking URL macro sub1={sub2} will be returnedCutomMacro2
{sub3}Exact value which was set by Partner in Tracking URL macro sub1={sub3} will be returnedCutomMacro3
{sub4}Exact value which was set by Partner in Tracking URL macro sub1={sub4} will be returnedCutomMacro4
{packageName}Package Name of the application. This is available only when the campaign is via the new campaign tracking method i.e. via the API /b/1/ucom.adgyde.adgydedemo
{install_time}Macro is returned in Unix Timestamp format1532081296
{click_time}Macro is returned in Unix Timestamp format1532081266
{campaign}Campaign NameTestMacroCampaign
{country_code}Should return country code but we are returning country name in this version as we do not capture country codeIndia
{city}City nameNoida
{device_brand}Brand of the device which triggered the installMotorola
{operator}Operator NameBSNL
{ip}Ip Address of the device. Sensitive information and the post back should be made available to the partner after internal discussion182.76.yy.xxx
{device_model}Model of the deviceNexus+6.0
{language}Language of the phoneen
{transaction_id}Unique id sent by AdGyde. This is available only when the campaign is via the new campaign tracking method i.e via the API /b/1/u1532081266741C1wRx
{sdk_ver}AdGyde SDK version1.1.0
{app_ver}Application Version1.9
{os_ver}OS version of the device6.0.1
{appName}Application Name as saved in AdGyde. This is available only when the campaign is via the new campaign tracking method i.e via the API /b/1/uAdGydeDemo


Example Install Post back URL:
http://www.adgyde.com?idfa={idfa}&advertiserId={advertiserId}&android-id={androidId}&app-id={packageName}&install-unix-ts={install_time}&click-ts={click_time}&camapign={camapign}&country-code={country_code}&city={city}&device-brand={device_brand}&carrier={operator}&ip={ip}&device-model={device_model}&language={language}&customclickid={transaction_id}&sdk-version={sdk_ver}&app-version={app_ver}&os-version={os_ver}&app-name={app_name}&clickid={clickid}&sub1={sub1}&sub2={sub2}&sub3={sub3}&sub4={sub4}&pub={pub}

Macros supported in In-app Event postback (S2S)
AdGyde through in-app events allows you to track any post-install event that you are interested in, relating to a media source and campaign.

You can track in-app events, such as:
  • Login
  • Add to cart
  • In-app purchases
  • Or any other logical event

You can also add a in-app revenue value to each event and this is available to you on your AdGyde dashboard. You can map these in-app events to your media source's defined events.

Below is the list of Macros supported in In-App Event post back
macrosCommentExample
{clickid}Unique Value sent by the partner1a76c87b3d49f82a
{eventid}Custom Value of the event saved when attaching the event to the campaign, this value is provided by Partner as per his system (&goal=1)1
{eventName}Name of the Event set by Advertiserregistration
{advertisingId}Google Advertising Id of the usere23c04c6-44aa-48fc-9781-xxxxxxxxxxxx
{androidId}Android Id of the application35aa72a37cxxxxxx
{idfa}Currently will be null as we do not capture any idfa value
{pub}Value of the sub-publisher can be passed for install segregation123 / ABC
{sub1}Exact value which was set by Partner in Tracking URL macro sub1={sub1} will be returnedCutomMacro1
{sub2}Exact value which was set by Partner in Tracking URL macro sub1={sub2} will be returnedCutomMacro2
{sub3}Exact value which was set by Partner in Tracking URL macro sub1={sub3} will be returnedCutomMacro3
{sub4}Exact value which was set by Partner in Tracking URL macro sub1={sub4} will be returnedCutomMacro4
{packageName}Package Name of the application. This is available only when the campaign is via the new campaign tracking method i.e via the API /b/1/ucom.adgyde.adgydedemo
{country_code}Should return country code but we are returning country name in this version as we do not capture country codeIndia
{city}City nameNoida
{device_brand}Brand of the device which triggered the installMotorola
{operator}Operator NameBSNL
{ip}Ip Address of the device. Sensitive information and the post back should be made available to the partner after internal discussion182.76.yy.xxx
{device_model}Model of the deviceNexus+6.0
{language}Language of the phoneen
{transaction_id}Unique id sent by AdGyde. This is available only when the campaign is via the new campaign tracking method i.e via the API /b/1/u1532081266741C1wRx
{sdk_ver}AdGyde SDK version1.1.0
{app_ver}Application Version1.9
{os_ver}OS version of the device6.0.1
{appName}Application Name as saved in AdGyde. This is available only when the campaign is via the new campaign tracking method i.e via the API /b/1/uAdGydeDemo
{timestamp}Time Stamp of the log received.


User Flow



1. Overview
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

Suppose for a Food Delivery Application the user flow is expected to be as below:
  1. User selects Restaurant
  2. User selects Cuisine
  3. Add to basket
  4. Payment Completed
Below user flow explains such behavior where users move from one activity to another.



User can even know the number of inflow and outflow of the users with respect to one node. For example, in below image 'Home' node tells the flow from root, category and promotion where blue represents 'inflow' and red represents 'outflow'.





2. Integration

Normal User Flow: In AdGyde Android SDK, User Flow is linked to the android application Life Cycle and so is calculated automatically without any requirement for integration.

Custom User Flow: In case application contains WebView’s and application needs to track user flow for the WebView views then this functionality can be used. Because WebView is a single activity and Android by default tracks activity flow.

To add a screen in User Flow, execute the setCurrentScreen function
AdGyde.setCurrentScreen(Context context, String ScreenName);

To remove a screen from User Flow, execute the removeCurrentScreen function
AdGyde.removeCurrentScreen(Context context, String ScreenName);

Below is the sample code for the custom postback which can be used with WebView pages

public class MainActivity extends AppCompatActivity
{
WebView simpleWebView;
Button loadWebPage;
String url ="https://www.adgyde.com";

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// initiate buttons and a web view
loadWebPage = (Button) findViewById(R.id.loadWebPage);
simpleWebView = (WebView) findViewById(R.id.simpleWebView);

loadWebPage.setOnClickListener(new View.OnClickListener()
{
@SuppressLint("SetJavaScriptEnabled")

@Override
public void onClick(View v)
{
simpleWebView.setWebViewClient(new MyWebViewClient());

simpleWebView.getSettings().setJavaScriptEnabled(true);
simpleWebView.loadUrl(url);
}
});
}

private class MyWebViewClient extends WebViewClient
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
String pageURL = view.getUrl();
String pageName="";
Log.d("xxxx", "page url----" + pageURL);
int countSls=pageURL.lastIndexOf("/")+1;
int countDot=pageURL.lastIndexOf(".");
if((countDot-countSls)>0)
{
pageName= pageURL.substring(pageURL.lastIndexOf("/") + 1, pageURL.lastIndexOf("."));
Log.d("xxxx", "page url----" + pageName);
AdGyde.setCurrentScreen(context, pageName);
}
else
{
pageName=pageURL.substring(pageURL.lastIndexOf("/") + 1, pageURL.length());
AdGyde.setCurrentScreen(context, pageName);
Log.d("xxxx", "page url----" + pageName);
}
return true;
}
}

public void onDestroy()
{
super.onDestroy();
}
}



1. Overview
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

Suppose for a Food Delivery Application the user flow is expected to be as below:
  1. User selects Restaurant
  2. User selects Cuisine
  3. Add to basket
  4. Payment Completed
Below user flow explains such behavior where users move from one activity to another.



User can even know the number of inflow and outflow of the users with respect to one node. For example, in below image 'Home' node tells the flow from root, category and promotion where blue represents 'inflow' and red represents 'outflow'.





2. Integration

Normal User Flow: Unity does not support have User Flow lifecycle as it is based on Single Activity. Therefore, User Flow can only be implemented as Custom User Flow in Unity

Custom User Flow: For each screen created in Unity the Screen adding function should be called and when user exits from that screen then screen should be removed from the stack.
AdGyde will be able to create an accurate user Flow and help to improve application only when the Custom User Flow is implemented in perfect manner

To add a screen in User Flow execute, the setCurrentScreen function
AdgydeManager.SharedInstance.setCurrentScreen(String ScreenName);

To remove a screen from User Flow execute, the removeCurrentScreen function
AdgydeManager.SharedInstance.removeCurrentScreen(String ScreenName);

Below is the sample code for the Custom Flow which can create the User Flow of the application

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Sample_UI_Class : MonoBehaviour {
private static Sample_UI_Class _instance = null;

public static Sample_UI_Class SharedInstance {
get {
// if the instance hasn’t been assigned then search for it
if (_instance == null) {
_instance = GameObject.FindObjectOfType(typeof(Sample_UI_Class)) as Sample_UI_Class;
}

return _instance;
}
}

void Awake(){
AdgydeManager.SharedInstance.setCurrentScreen("Home_Page");
// Set Current Screen to Stack
}

void OnApplicationQuit(){
AdgydeManager.SharedInstance.removeCurrentScreen("Home_Page");
// Remove Current Screen from Stack
}

void showNextScreen(String NewScreen){
AdgydeManager.SharedInstance.setCurrentScreen(NewScreen);
// Set Current Screen to Stack
}

void showPreviousScreen(String NewScreen, String OldScreen){
AdgydeManager.SharedInstance.removeCurrentScreen(OldScreen);
// Remove Current Screen from Stack
showNextScreen(NewScreen);
}



1. Overview
'User Flow' allows the Application Developer to gauge the movement of its users through the activities defined in the application. By analyzing the user flow Sankey diagram, the App developer can predict which activity is most popular among its users and where the drop-off rates are high.

Suppose for a Food Delivery Application the user flow is expected to be as below:
  1. User selects Restaurant
  2. User selects Cuisine
  3. Add to basket
  4. Payment Completed
Below user flow explains such behavior where users move from one activity to another.



User can even know the number of inflow and outflow of the users with respect to one node. For example, in below image 'Home' node tells the flow from root, category and promotion where blue represents 'inflow' and red represents 'outflow'.





2. Integration

Normal User Flow: Cordova does not support the User Flow lifecycle as it is based on Single Activity. Therefore, User Flow can only be implemented as a Custom User Flow in Cordova

Custom User Flow: For each screen created in Cordova the Screen adding function should be called and when user exits from that screen then screen should be removed from the stack.
AdGyde will be able to create an accurate user Flow and help to improve application only when the Custom User Flow is implemented in perfect manner

To add a screen in User Flow, execute the setCurrentScreen function
AdGydeTracker.setCurrentScreen(String ScreenName);

To remove a screen from User Flow, execute the removeCurrentScreen function
AdGydeTracker.removeCurrentScreen(String ScreenName);

Below is the sample code for the Custom Flow which can create the User Flow of the application

document.addEventListener("deviceready",
function() {
AdGydeTracker.setCurrentScreen("Counting_Event_Page");
}
);




Sessions



Overview
Android application is a set of Activities and the relationship between application and activities is loose. One of the most common case issues is that the application won't quit after the BACK key is pressed this makes the developers & user confused. AdGyde redefined session to makes it easy to understand.

Definition of session
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. In user’s perspective, pressing BACK key on main activity or click on quit button on the application will initiate application quit, but instead these tasks switch the application to background which is quite hard to understand.

Normally developer use finish() to quit application by code.
public class MainActivity extends Activity {
protected onCreate(Context context) {
// some code
Button quitButton = (Button)findViewById(R.id.quitAppButton);
quitButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// quit application by close main activity
MainActivity.this.finish();
}
});
}
}

MainActivity.this.finish() will close the main activity but won't quit the application, this just puts the application to background. In understanding the MainActivity should be created when user starts the application again, but as application is already in background it just switches background to foreground.

AdGyde redefines quitting of the application - As soon as the user closes the last activity the session is closed. It is exactly in accordance with the user experience with the application. Pressing BACK key on last activity will be considered as the user wants to quit the application.

Scenarios of session
1. End with BACK key
  1. User starts application, session begins
  2. Main activity is created
  3. User presses BACK key
  4. Main activity is destroyed
  5. Session ends
2. Exit by code
  1. User starts application, session begins
  2. Main activity is created
  3. User click on 'quit' button of main activity
  4. Main activity is destroyed
  5. Session ends
3. Switch to background
  1. User starts application, session begins
  2. Main activity is created
  3. User presses HOME key to go to home screen
  4. User click application icon after 45 seconds
  5. Application is brought to front, session is closed, new session begins

  6. Session will be closed if the application was switched to background for more than 30 seconds, as it is assumed that the user switched to another task / application and the application in context is not in use.
4. Killed by system task manager
  1. User starts application, session begins
  2. User presses the HOME key to open system task manager
  3. User kills application with system task manager. Session ends
5. Killed by system
  1. User starts application, Session starts
  2. User switches to another application
  3. Application is running in background; application gets killed by system for low memory. Session ends

Session Integration Steps
In AdGyde Android SDK, sessions are linked to the android application Life Cycle and so are calculated automatically without any integration.



Overview
Android application is a set of Activities and the relationship between application and activities is loose. But in case of Unity, Activities is created by Unity framework therefore only One Activity is created by Android. Still base is android and therefore one of the most common case issues is that the application won't quit after the BACK key is pressed this makes the developers & user confused. AdGyde redefined session to makes it easy to understand.

Definition of session
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. In user’s perspective, pressing BACK key on main activity or click on quit button on the application will initiate application quit, but instead these tasks switch the application to background which is quite hard to understand.

In understanding the MainActivity should be created when user starts the application again, but as application is already in background it just switches background to foreground.

AdGyde redefines quitting of the application - As soon as the user closes the last activity the session is closed. It is exactly in accordance with the user experience with the application. Pressing BACK key on last activity will be considered as the user wants to quit the application.

Scenarios of session
1. End with BACK key
  1. User starts application, session begins
  2. Main activity is created
  3. User presses BACK key
  4. Main activity is destroyed
  5. Session ends
2. Exit by code
  1. User starts application, session begins
  2. Main activity is created
  3. User click on 'quit' button of main activity
  4. Main activity is destroyed
  5. Session ends
3. Switch to background
  1. User starts application, session begins
  2. Main activity is created
  3. User presses HOME key to go to home screen
  4. User click application icon after 45 seconds
  5. Application is brought to front, session is closed, new session begins

  6. Session will be closed if the application was switched to background for more than 30 seconds, as it is assumed that the user switched to another task / application and the application in context is not in use.
4. Killed by system task manager
  1. User starts application, session begins
  2. User presses the HOME key to open system task manager
  3. User kills application with system task manager. Session ends
5. Killed by system
  1. User starts application, Session starts
  2. User switches to another application
  3. Application is running in background; application gets killed by system for low memory. Session ends

Session Integration Steps
In Unity, sessions are not linked to the application Life Cycle and so the session functions need to be executed from unity lifecycle functions.
The AdGyde lifecycle functions which record the sessions need to be liked directly to functions in Unity Lifecycle. Below is the example code where this direct linking is shown

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Sample_UI_Class : MonoBehaviour {
private static Sample_UI_Class _instance = null;
public static Sample_UI_Class SharedInstance {
get {
// if the instance hasn't been assigned then search for it
if (_instance == null) {
_instance = GameObject.FindObjectOfType(typeof(Sample_UI_Class)) as Sample_UI_Class;
}

return _instance;
}
}

public Text DebugLog;

void Start() {
AdgydeManager.SharedInstance.CallOnStart();
}

void OnApplicationQuit() {
Quit ();
}

void OnApplicationKill() {
Quit ();
}

public void Quit() {
AdgydeManager.SharedInstance.CallOnStop ();
Application.Quit();
}

void OnApplicationPause(bool isPause) {
if (isPause) {
AdgydeManager.SharedInstance.CallOnPause ();
}
else
{
AdgydeManager.SharedInstance.CallOnResume ();
}

IEnumerator CallDelayDestroy (float waitTime) {
// session destroy
AdgydeManager.SharedInstance.CallOnDestroy ();
}
}
}




Overview
Android application is a set of Activities and the relationship between application and activities is loose. But in case of Cordova, Activities is created by Unity framework therefore only One Activity is created by Android. Still base is android and therefore one of the most common case issues is that the application won't quit after the BACK key is pressed this makes the developers & user confused. AdGyde redefined session to makes it easy to understand.

Definition of session
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. In user’s perspective, pressing BACK key on main activity or click on quit button on the application will initiate application quit, but instead these tasks switch the application to background which is quite hard to understand.

In understanding the MainActivity should be created when user starts the application again, but as application is already in background it just switches background to foreground.

AdGyde redefines quitting of the application - As soon as the user closes the last activity the session is closed. It is exactly in accordance with the user experience with the application. Pressing BACK key on last activity will be considered as the user wants to quit the application.

Scenarios of session
1. End with BACK key
  1. User starts application, session begins
  2. Main activity is created
  3. User presses BACK key
  4. Main activity is destroyed
  5. Session ends
2. Exit by code
  1. User starts application, session begins
  2. Main activity is created
  3. User click on 'quit' button of main activity
  4. Main activity is destroyed
  5. Session ends
3. Switch to background
  1. User starts application, session begins
  2. Main activity is created
  3. User presses HOME key to go to home screen
  4. User click application icon after 45 seconds
  5. Application is brought to front, session is closed, new session begins

  6. Session will be closed if the application was switched to background for more than 30 seconds, as it is assumed that the user switched to another task / application and the application in context is not in use.
4. Killed by system task manager
  1. User starts application, session begins
  2. User presses the HOME key to open system task manager
  3. User kills application with system task manager. Session ends
5. Killed by system
  1. User starts application, Session starts
  2. User switches to another application
  3. Application is running in background; application gets killed by system for low memory. Session ends

Session Integration Steps
In Cordova Android Plugin, sessions are linked to the android application Life Cycle and so are calculated automatically without any integration.




Offline Campaign - Tracking Installs


This section talks about the tracking solutions for following
  1. Pre-load campaign
  2. Offline campaigns without GAID
  3. Offline campaigns with GAID

Pre-load Campaigns
To track the campaigns in AdGyde the advertiser needs to integrate the Pre-Load channel in the application itself and then share the APK with the pre-load partner.

Offline Campaigns without GAID
To track the campaigns in AdGyde the advertiser needs to integrate the offline channel in the application itself and then run the campaign though notification of some store. We can also share a tracking link which help to download the APK.

Campaigns can be created in AdGyde with partners allowing the advertiser to track CPI, CPR and CPM type campaigns.
For tracking offline campaigns without GAID
  1. Pass the following as parameter in AdGyde.init() function
    Channel Name = ChannelName_offlinewd_CampaignId
    Example: Loopback_offlinewd_125

  2. Pass the &offlinewd=true parameter in the Campaign Tracking URL
    i.e. https://log2.adgyde.com/intf/b/1/o?c={Campaign Open Id}&p={Partner Id}&ag_r={RedirectUrl}&offlinewd=true

Offline Campaigns with GAID
To track the Offline Campaigns with GAID the advertiser needs to create a campaign in the AdGyde Panel, specify the APK link from where the APK will be downloaded. Most important part is that the GAID should be passed in the campaign link.


Creating the Offline Tracking Links
1. Integrated Partners Tracking Links
  1. Login to the AdGyde Console
  2. Click on setup
  3. Go to the Campaign Tracking.
  4. Click on '+New Campaign'
  5. Enter the Name of the campaign and select the range of click attribution look back window
  6. Click on Create button



  7. Click on '+' Button under channel and choose the partner you want work within channel name
  8. Click on the offline check box for offline campaigning (As circled on below image)
  9. Copy the Tracking link



  10. Copy the Tracking link and make modifications for different offline campaigns
    • Offline without GAID : Remove androidid={androidid} or advertisingId={advertisingid} from the offline tracking link
      Add offlinewd=true in this url. Now the offline campaign tracking without device id url will look like this :
      https://log2.adgyde.com/intf/b/1/o?c={Campaign Open Id}&p={PartnerId}&ag_r={Redirect Url}&offlinewd=true

    • Offline with GAID : Pass the GAID or android id / device id in the URL for tracking the APK without any change

  11. For Pre-Embed and Offline Tracking without GAID, channel details need to be hardcoded in the APK itself While calling the AdGyde.init() function for the channel name parameter, provide the channel as specified below, same will be shown on the AdGyde Console
    • Pre-Embed : use Pre_embed as channel name to track installs on AdGyde Panel as pre-embed
      AdGyde.init(this, "Your Appkey", "Pre_embed");

    • Offline without GAID : use the string with '_offlinewd_' . (For example: if channel name is Loopback then keep the parameter name as Loopback_offlinewd_campaignid)
      AdGyde.init(this, "Your Appkey", "Loopback_offlinewd_125");

  12. Create a downloadable link for the APK, replace the value of the macro ag_r in the tracking link (Which was copied from the Console) with the link of the APK (Make sure APK file is getting downloaded from this link).
  13. The created link is now ready to be shared with your partner for running the campaign.

Offline Campaign Install Test
  1. Please start testing using a fresh device on which the application was never installed before or use a whitelisted device.
  2. Make sure that int application APK you are installing has the AdGyde SDK integrated
  3. Launch the application after install and use for few seconds
  4. AdGyde dashboard should now show the installation conversion under ‘non-organic’ on the Console.

Note: The name of the partner / Channel and Campaign Id set in AdGyde.init(this, "app-Key", "channel_offlinewd_campaignid") should be exactly as the name entered during Campaign creation in AdGyde Console.

package com.adgyde.example;

import android.app.Application;
import android.util.Log;

import com.adgyde.android.AdGyde;

public class ExampleApplication extends Application implements Constants {
@Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "ExampleApplication.onCreate()");
// Initialize AdGyde SDK with appkey & default channel id.
// SDK will use default channel id if no INSTALL_REFERRER being sent by Google Play Service.
// This case only will happen in debug. (Install APK to phone with adb.)
AdGyde.init(this, "app-key", "Loopback_offlinewd_125");
AdGyde.setDebugEnabled(true);
}
}

Online Campaign - Tracking Installs


AdGyde Attribution and Analytics solution has integrated ad partners for mobile advertising channels; you can also attribute app installs driven by your campaigns.

AdGyde supports
  • CPI (Cost per Impression)
  • CPC (Cost per Clicks),
  • CPR (Cost per Registration),
  • CPA (Cost per Acquisition)

Measuring campaigns in your Attribution Analytics account requires two things:
  • Add an internal partner to associate your campaigns to

    Note: Partners which are already integrated with AdGyde are called Integrate Partners. In case your partner is not found in Integrated partners, please request partner to initiate integration by filling the Partner Integration Form https://www.adgyde.com/partners.php or ask them to contact us at support@adgyde.com

  • Generate a measurement URL


Online Campaign Flow





Adding a Campaign for an Internal Partner
To generate a measurement URL to use in your marketing campaign, you need to create a "Campaign" after filling in the campaign details

Add New Campaign
  1. Login to the AdGyde console
  2. Click on Setup
  3. Go to the Campaign Menu and Click on “+New Campaign” to start adding the new campaign
  4. Enter the Name of campaign and select the range of click attribution look back window
  5. Click on Create button



Campaign Tracking Details
  1. Click on “+” button under channel and choose the partner you want to work with in channel name
  2. Set the cost for per non-organic download (Cost per install) for the specific partner
  3. The created link; is now ready to be shared with your partner for running the campaign.



  4. If required the S2S Events (In-app Events like Registration and Play) can be setup for campaigns like ‘click-per-registration’, ‘click-per-play’
  5. Add partner event Tag in the console which will be corresponding to the Event name (this partner event tag will be provided by your partner)
  6. Click on Update Button

Campaign Tracking Details
After the campaign is live, the resulting app installs driven through this campaign can be viewed in the Attribution Analytics Report under campaign performance.
  1. New Users per Channel
  2. Valuable users per channel
  3. Cost per Channel
  4. Clicks per installs per channel
  5. Revenue generated per channel
  6. Deferred Deep Link count per Channel
  7. Deep Link count per Channel
  8. Re-Attribution per Channel



DeepLinking



Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

1. How Deep Link works
When User click on the Campaign link and If the app is installed the deep linking will be used to open the app and direct the user to a specific page. If the application is not installed, then the campaign runs as normal and a user can install the application

Below pictures shows the deep link scenario.



2. Deep linking integration steps
To allow user to enable the deep linking. we provide the user interface in the AdGyde Console. Using following steps user can enable deep linking.

  1. Login in to AdGyde Console
  2. Click on setup option
  3. Click on Deep Linking
  4. Click on +Create New Scheme for deep linking of application
  5. Select your Application from dropdown, set scheme name, enter scheme name which is passed in AndroidManifest.xml, Set host name and Path
  6. Click on Create Scheme.



    E. g. If you want to deep link following Link - https://www.adgyde.com/demo
    • Scheme : https. At least one scheme attribute must be set for the Intent filter
    • Host : www.adgdye.com
    • Path : /demo, identifying the specific resource (path start with “/”)

    E. g. If you want to deep link following Link - adgyde://demo/registration
    • Scheme : adgyde
    • Host : demo
    • Path : /registration

    With this scheme and details you can get your custom scheme setup and use same


  7. Now enable deep link for campaign. Click on setup option
  8. Click on Campaign Tracking
  9. Click on +New campaign for create new campaign which is used for enabling the deep linking
  10. After creating new campaign click on Plus (+) Button
  11. Click on Enable deep linking
  12. Select deep link scheme from drop down
  13. Enter Application Class Name (Activity Name), where you want to go after deep link
  14. Enter Data URL for when campaign click on Desktop browser then data URL content is open
  15. Copy the auto generated intent-filter and paste into the your AndroidManifest.xml
  16. Click on Update Button to update your campaign with deep linking.




Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

1. How Deep Link works
When User click on the Campaign link and If the app is installed the deep linking will be used to open the app and direct the user to a specific page. If the application is not installed, then the campaign runs as normal and a user can install the application

Below pictures shows the deep link scenario.



2. Deep linking integration steps
To allow user to enable the deep linking. we provide the user interface in the AdGyde Console. Using following steps user can enable deep linking.

  1. Login in to AdGyde Console
  2. Click on setup option
  3. Click on Deep Linking
  4. Click on +Create New Scheme for deep linking of application
  5. Select your Application from dropdown, set scheme name, enter scheme name which is passed in AndroidManifest.xml, Set host name and Path
  6. Click on Create Scheme.



    E. g. If you want to deep link following Link - https://www.adgyde.com/demo
    • Scheme : https. At least one scheme attribute must be set for the Intent filter
    • Host : www.adgdye.com
    • Path : /demo, identifying the specific resource (path start with “/”)

    E. g. If you want to deep link following Link - adgyde://demo/registration
    • Scheme : adgyde
    • Host : demo
    • Path : /registration

    With this scheme and details you can get your custom scheme setup and use same


  7. Now enable deep link for campaign. Click on setup option
  8. Click on Campaign Tracking
  9. Click on +New campaign for create new campaign which is used for enabling the deep linking
  10. After creating new campaign click on Plus (+) Button
  11. Click on Enable deep linking
  12. Select deep link scheme from drop down
  13. Enter Application Class Name (Activity Name), where you want to go after deep link
  14. Enter Data URL for when campaign click on Desktop browser then data URL content is open
  15. Copy the auto generated intent-filter and paste into the your AndroidManifest.xml
  16. Click on Update Button to update your campaign with deep linking.



  17. As Unity has only a single Screen and user themselves implement the scenes and screens, therefore deep linking data is not passed to screen instead user can extract data whenever required. To fetch the data for processing at user's discretion use the following function as given below :

    String data = AdgydeManager.SharedInstance.getDeepLinkData();



Deep linking is the act of launching a mobile app while serving personalized content or sending the users to specific activities within the application.

1. How Deep Link works
When User click on the Campaign link and If the app is installed the deep linking will be used to open the app and direct the user to a specific page. If the application is not installed, then the campaign runs as normal and a user can install the application

Below pictures shows the deep link scenario.



2. Deep linking integration steps
To allow user to enable the deep linking. we provide the user interface in the AdGyde Console. Using following steps user can enable deep linking.

  1. Login in to AdGyde Console
  2. Click on setup option
  3. Click on Deep Linking
  4. Click on +Create New Scheme for deep linking of application
  5. Select your Application from dropdown, set scheme name, enter scheme name which is passed in AndroidManifest.xml, Set host name and Path
  6. Click on Create Scheme.



    E. g. If you want to deep link following Link - https://www.adgyde.com/demo
    • Scheme : https. At least one scheme attribute must be set for the Intent filter
    • Host : www.adgdye.com
    • Path : /demo, identifying the specific resource (path start with “/”)

    E. g. If you want to deep link following Link - adgyde://demo/registration
    • Scheme : adgyde
    • Host : demo
    • Path : /registration

    With this scheme and details you can get your custom scheme setup and use same


  7. Now enable deep link for campaign. Click on setup option
  8. Click on Campaign Tracking
  9. Click on +New campaign for create new campaign which is used for enabling the deep linking
  10. After creating new campaign click on Plus (+) Button
  11. Click on Enable deep linking
  12. Select deep link scheme from drop down
  13. Enter Application Class Name (Activity Name), where you want to go after deep link
  14. Enter Data URL for when campaign click on Desktop browser then data URL content is open
  15. Copy the auto generated intent-filter and paste into the your AndroidManifest.xml
  16. Click on Update Button to update your campaign with deep linking.



  17. As Cordova has only a single Screen and user themselves implement the multiple screens, therefore deep linking data is not passed to screen instead user can extract data whenever required. To fetch the data for processing at user's discretion use the following function as given below :

    function GetDLData() {
    AdGydeTracker.GetDeeplinkData(success, error);
    function success(data) {
    alert(data);
    }

    function error(error) {
    alert(JSON.stringify(error));
    }
    }




Events



Event is a powerful tool to track interaction between user and mobile application.
There are 3 kinds of events, which are
  1. Simple Event
  2. Counting Event
  3. Computing Event

1. Simple Event
Simple event is an event without parameters. It can be used to track simple event. For example, if you need to track how many times which user launch your application. Just put a line at onCreate() of main activity.

public void onCreate() {
// fire simple event named "Launch my application"
AdGyde.onSimpleEvent("Launch my application");
}

Simple event can be used to construct funnel, the details for same can be found under funnel section.

For more complicated event tracking - Counting Event or Computing Event should be considered.

2. Counting Event
Counting Event is useful to track event which needs counting. For example, if we are developing a news application. This application has three categories, which are local news, national news and international news. We need to know which category is the most popular, just implement the following code on click listener.

/**
* Being triggered if "Local News" tab clicked.
*/
public void onCategoryLocalNewsClicked(View view) {
Map<String, String> params = new HashMap<String, String>();
// params.put(patrametre_name, value);
params.put("category", "local news");
AdGyde.onCountingEvent("selected category", params);
}

/**
* Being triggered if "National News" tab clicked.
*/
public void onCategoryNationalNewsClicked(View view) {
Map<String, String> params = new HashMap<String, String>();
// params.put(patrametre_name, value);
params.put("category", "national news");
AdGyde.onCountingEvent("selected category", params);
}

/**
* Being triggered if "International News" tab clicked.
*/
public void onCategoryInternationalNewsClicked(View view) {
Map<String, String> params = new HashMap<String, String>();
// params.put(patrametre_name, value);
params.put("category", "international news");
AdGyde.onCountingEvent("selected category", params);
}

As the events are different and AdGyde Server needs to differentiate that the event is counting event, therefore events need to be added in console with specified type.

Following are the steps to add counting event in Console
  1. Login to AdGyde console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'selected category' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map<String, String>)
  6. Enter 'category' on parameter_name field
  7. Select 'Counting' item of comp_param_type field
  8. Click on 'Create' button



3. Computing Event
Computing Event can be used to track accumulative values.

E.g. If we put our banner in application with different Weightage or say Cost, then using the computing event we can know the Contribution of each Banner as per weightage assigned.

/**
* Invoked when advertisement clicked.
*/
public void onAdvertismentClicked(Advertisement adv) {
Map<String, String> params = new HashMap<String, String>();
// First parameter is event name and second is value name which will be accumulated.
params.put("CPM", adv.getName());
// Second parameter is the value for its value name. Value must be integer type.
params.put(adv.getName(), "" + adv.getPrice());
// Trigger event where first parameter is event_id
AdGyde.onComputingEvent("CPM income", params);
}

Computing event uses 2 parameters. First parameter defines event id say 'CPM' and parameter which will be accumulated. Second parameter defines parameter value. For example, news application placed 2 banners. First is 'adv1', CPM is 1 cent. Second is 'adv2', CPM is 5 cents. 'adv1' clicked 5 times, 'adv2' clicked 10 times. Accumulated value is 'adv1'=1 cent * 5=5 cents, 'adv2'=5 cents * 10=50 cents.

The process of defining the computing event is like counting event, but com_param_type should be set to 'Computing'.



4. Revenue Event
There is a separate Revenue event which should and can be used for keeping track of revenue generated through the application. Revenue shown in the console is also based on this event only.

private void fireRevenueEvent() {
AdGyde.onRevenue(17);
}

5. Unique Event
Unique Event is useful to track events which need unique counting in a specific time period. For example, if we develop a news application. This application has three categories, which are local news, national news and international news.

AdGyde provides Unique Events in three types
  1. onDailyUnique
  2. onPermanentUnique
  3. onCustomUnique

The 3 Types of Unique events can be used for different requirements
  1. To know how many unique users complete the Game Stage in each date, onDailyUnique should be used
  2. To know how many unique users complete the Game Stage in user lifetime, onPermanentUnique should be used
  3. To know how many unique users complete the Game Stage in 24 Hours, onCustomUnique should be used
For the unique event following code needs to be implemented
/**
* Daily Unique event allows to keep an event unique for current date
* When user completes Game Stage
*/
public void onGameStageCompleted(View view) {
Map<String, String> params = new HashMap<String, String>();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.put("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
AdGyde.onDailyUnique("GameLevelComplete", params);
}

/**
* Permanent Unique event allows to keep an event unique for user lifetime
*/
public void onGameStageCompletedUnique(View view) {
Map<String, String> params = new HashMap<String, String>();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.put("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
params.onPermanentUnique("GameLevelComplete", params);
}

/**
* Custom Unique event allows to keep an event unique for user defined time (hours)
*/
public void onCategoryInternationalNewsClicked(View view) {
Map<String, String> params = new HashMap<String, String>();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.put("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
// The third parameter (3) specifies that the Event will not be counted again before 3 hours
params.onCustomUnique("GameLevelComplete", params, 3);
}


As the events are different and AdGyde Server needs to differentiate that the event is unique event, therefore events need to be added in console with specified type.

Please follow instructions below to create unique event
  1. Login into AdGyde Console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'GameLevelComplete' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map, Boolean flag)
  6. Enter 'Level' on parameter_name field
  7. Select 'Unique Event' item of comp_param_type field
  8. Click on 'Create' button


Event is a powerful tool to track interaction between user and mobile application.
There are 3 kinds of events, which are
  1. Simple Event
  2. Counting Event
  3. Computing Event

1. Simple Event
Simple event is an event without parameters. It can be used to track simple event. For example, if you need to track how many times which user launch your application. Just put a line at onCreate() of main activity.

public void onCreate() {
// fire simple event named "Launch my application"
AdgydeDemo.SharedInstance.SimpleEvent("Launch my application");
}

Simple event can be used to construct funnel, the details for same can be found under funnel section.

For more complicated event tracking - Counting Event or Computing Event should be considered.

2. Counting Event
Counting Event is useful to track event which needs counting. For example, if we are developing a news application. This application has three categories, which are local news, national news and international news. We need to know which category is the most popular, just implement the following code on click listener.

/**
* Being triggered if "Local News" tab clicked.
*/
public void onCategoryLocalNewsClicked() {
Dictionary parameter = new Dictionary();
// parameter.Add (parameter_name, value);
parameter.Add (“Category”, “local News”);
// AdgydeDemo.SharedInstance.CountingEvent (eventid, parameter);
AdgydeDemo.SharedInstance.CountingEvent (“selected category”, parameter);
}

/**
* Being triggered if "National News" tab clicked.
*/
public void onCategoryNationalNewsClicked () {
Dictionary parameter = new Dictionary();
// parameter.Add (parameter_name, value);
parameter.Add (“Category”, “national News”);
// AdgydeDemo.SharedInstance.CountingEvent (eventid, parameter);
AdgydeDemo.SharedInstance.CountingEvent (“selected category”, parameter);
}

/**
* Being triggered if "International News" tab clicked.
*/
public void onCategoryInternationalNewsClicked () {
Dictionary parameter = new Dictionary();
// parameter.Add (parameter_name, value);
parameter.Add (“Category”, “InternationalNews”);
// AdgydeDemo.SharedInstance.CountingEvent (eventid, parameter);
AdgydeDemo.SharedInstance.CountingEvent (“selected category”, parameter);
}


As the events are different and AdGyde Server needs to differentiate that the event is counting event, therefore events need to be added in console with specified type.

Following are the steps to add counting event in Console
  1. Login to AdGyde console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'selected category' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map<String, String>)
  6. Enter 'category' on parameter_name field
  7. Select 'Counting' item of comp_param_type field
  8. Click on 'Create' button



3. Computing Event
Computing Event can be used to track accumulative values.

E.g. If we put our banner in application with different Weightage or say Cost, then using the computing event we can know the Contribution of each Banner as per weightage assigned.

/**
* Invoked when advertisement clicked.
*/
public void onAdvertismentClicked(Advertisement adv) {
Dictionary parameter = new Dictionary();
// First parameter is event name and second is value name which will be accumulated.
parameter.Add (“CPM”, adv.getName());
// Second parameter is the value for its value name. Value must be integer type.
parameter.Add(adv.getName(),adv.getPrice());
// Trigger event where first parameter is event_id
AdgydeDemo.SharedInstance.ComputingEvent("CPM income", parameter);
}

Computing event uses 2 parameters. First parameter defines event id say 'CPM' and parameter which will be accumulated. Second parameter defines parameter value. For example, news application placed 2 banners. First is 'adv1', CPM is 1 cent. Second is 'adv2', CPM is 5 cents. 'adv1' clicked 5 times, 'adv2' clicked 10 times. Accumulated value is 'adv1'=1 cent * 5=5 cents, 'adv2'=5 cents * 10=50 cents.

The process of defining the computing event is like counting event, but com_param_type should be set to 'Computing'.



4. Revenue Event
There is a separate Revenue event which should and can be used for keeping track of revenue generated through the application. Revenue shown in the console is also based on this event only.

private void fireRevenueEvent() {
AdgydeDemo.SharedInstance.OnRevenue(17);
}

5. Unique Event
Unique Event is useful to track events which need unique counting in a specific time period. For example, if we develop a news application. This application has three categories, which are local news, national news and international news.

AdGyde provides Unique Events in three types
  1. onDailyUnique
  2. onPermanentUnique
  3. onCustomUnique

The 3 Types of Unique events can be used for different requirements
  1. To know how many unique users complete the Game Stage in each date, onDailyUnique should be used
  2. To know how many unique users complete the Game Stage in user lifetime, onPermanentUnique should be used
  3. To know how many unique users complete the Game Stage in 24 Hours, onCustomUnique should be used
For the unique event following code needs to be implemented
/**
* Daily Unique event allows to keep an event unique for current date
* When user completes Game Stage
*/
public void onGameStageCompleted() {
Dictionary params = new Dictionary();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.Add(("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
AdgydeDemo.SharedInstance.onDailyUnique("GameLevelComplete", params);
}

/**
* Permanent Unique event allows to keep an event unique for user lifetime
*/
public void onGameStageCompletedUnique() {
Dictionary params = new Dictionary();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.Add("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
AdgydeDemo.SharedInstance.onPermanentUnique("GameLevelComplete", params);
}

/**
* Custom Unique event allows to keep an event unique for user defined time (hours)
*/
public void onCategoryInternationalNewsClicked() {
Dictionary params = new Dictionary();
//The parameter being passed in unique event are in combination of ParameterName and Value
params.Add("Level", "level_1");

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
// The third parameter (3) specifies that the Event will not be counted again before 3 hours
AdgydeDemo.SharedInstance.onCustomUnique("GameLevelComplete", params, 3);
}


As the events are different and AdGyde Server needs to differentiate that the event is unique event, therefore events need to be added in console with specified type.

Please follow instructions below to create unique event
  1. Login into AdGyde Console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'GameLevelComplete' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map, Boolean flag)
  6. Enter 'Level' on parameter_name field
  7. Select 'Unique Event' item of comp_param_type field
  8. Click on 'Create' button


Event is a powerful tool to track interaction between user and mobile application.
There are 3 kinds of events, which are
  1. Simple Event
  2. Counting Event
  3. Computing Event

1. Simple Event
Simple event is an event without parameters. It can be used to track simple event. For example, if you need to track how many times which user launch your application. Just put a line at onCreate() of main activity.

function simpleEvent() {
// fire simple event named "Registration"
AdGydeTracker.simpleEvent("Registration");
window.plugins.toast.showShortBottom(
'Simple Event Triggered',
function(a){
console.log('toast success: ' + a)
},
function(b){
alert('toast error: ' + b)
}
);
}

Simple event can be used to construct funnel, the details for same can be found under funnel section.

For more complicated event tracking - Counting Event or Computing Event should be considered.

2. Counting Event
Counting Event is useful to track event which needs counting. For example, if we are developing a news application. This application has three categories, which are local news, national news and international news. We need to know which category is the most popular, just implement the following code on click listener.

function showToast(ToastText) {
window.plugins.toast.showShortBottom(
ToastText,
function(a){
console.log('toast success: ' + a)
},
function(b){
alert('toast error: ' + b)
}
);
}

/**
* Being triggered if "Local News" tab clicked.
*/
function countingEventLocal() {
// parameter to be passed {"parameter_name" : "value"}
var parameter={"Category":"local News"};
// AdGydeTracker.countingEvent(eventid, parameter);
AdGydeTracker.countingEvent("CountingEvent", parameter);

showToast('Counting Event Triggered');
}

/**
* Being triggered if "National News" tab clicked.
*/
function countingEventNational() {
// parameter to be passed {"parameter_name" : "value"}
var parameter={"Category":"National News"};
// AdGydeTracker.countingEvent(eventid, parameter);
AdGydeTracker.countingEvent("CountingEvent", parameter);

showToast('Counting Event Triggered');
}

/**
* Being triggered if "International News" tab clicked.
*/
function countingEventInternatonal() {
// parameter to be passed {"parameter_name" : "value"}
var parameter={"Category":"International News"};
// AdGydeTracker.countingEvent(eventid, parameter);
AdGydeTracker.countingEvent("CountingEvent", parameter);

showToast('Counting Event Triggered');
}


As the events are different and AdGyde Server needs to differentiate that the event is counting event, therefore events need to be added in console with specified type.

Following are the steps to add counting event in Console
  1. Login to AdGyde console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'selected category' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map<String, String>)
  6. Enter 'category' on parameter_name field
  7. Select 'Counting' item of comp_param_type field
  8. Click on 'Create' button



3. Computing Event
Computing Event can be used to track accumulative values.

E.g. If we put our banner in application with different Weightage or say Cost, then using the computing event we can know the Contribution of each Banner as per weightage assigned.

/**
* Invoked when advertisement clicked.
*/
function onAdvertismentClicked(name, price) {

// First Array entry is for Parameter Name and Sub-event name which will be accumulated.
// Second Array entry is for Sub-event name and its accumulating value. Value must be integer type.
var parameters={"CPM":name, name:price};

// Trigger event where first parameter is event_id
AdGydeTracker.computingEvent("CPM income", parameters);

showToast('Computing Event Triggered');
}

Computing event uses 2 parameters. First parameter defines event id say 'CPM' and parameter which will be accumulated. Second parameter defines parameter value. For example, news application placed 2 banners. First is 'adv1', CPM is 1 cent. Second is 'adv2', CPM is 5 cents. 'adv1' clicked 5 times, 'adv2' clicked 10 times. Accumulated value is 'adv1'=1 cent * 5=5 cents, 'adv2'=5 cents * 10=50 cents.

The process of defining the computing event is like counting event, but com_param_type should be set to 'Computing'.



4. Revenue Event
There is a separate Revenue event which should and can be used for keeping track of revenue generated through the application. Revenue shown in the console is also based on this event only.

/**
* Invoked when Revenue needs to be calculated.
*/
function revenueEvent() {
// Record successful Revenue for 17 Units (Units can be defined on Console)
AdGydeTracker.eventRevenue(17);
showToast('In App Revenue Event Triggered');
}

5. Unique Event
Unique Event is useful to track events which need unique counting in a specific time period. For example, if we develop a news application. This application has three categories, which are local news, national news and international news.

AdGyde provides Unique Events in three types
  1. onDailyUnique
  2. onPermanentUnique
  3. onCustomUnique

The 3 Types of Unique events can be used for different requirements
  1. To know how many unique users complete the Game Stage in each date, onDailyUnique should be used
  2. To know how many unique users complete the Game Stage in user lifetime, onPermanentUnique should be used
  3. To know how many unique users complete the Game Stage in 24 Hours, onCustomUnique should be used
For the unique event following code needs to be implemented
/**
* Daily Unique event allows to keep an event unique for current date
* When user completes Game Stage
*/
function onGameStageCompleted() {
//The parameter being passed in unique event are in combination of ParameterName and Value
var parameters={"Level":"level_1"};

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
AdGydeTracker.eventDailyUnique("GameLevelComplete", parameters);

showToast('Daily Unique Event Triggered');
}

/**
* Permanent Unique event allows to keep an event unique for user lifetime
*/
public void onGameStageCompletedUnique() {
//The parameter being passed in unique event are in combination of ParameterName and Value
var parameters={"Level":"level_1"};

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
AdGydeTracker.eventPermanentUnique("GameLevelComplete",parameters);

showToast('Permanent Unique Event Triggered');
}

/**
* Custom Unique event allows to keep an event unique for user defined time (hours)
*/
public void onCategoryInternationalNewsClicked() {
//The parameter being passed in unique event are in combination of ParameterName and Value
var parameters={"Level":"level_1"};

// Event is triggered with EventId and Parameters prepared above, the same are passed in this function
// The third parameter (3) specifies that the Event will not be counted again before 3 hours
AdGydeTracker.eventCustomUnique("GameLevelComplete",parameters, 3);

showToast('Custom Unique Event Triggered');
}


As the events are different and AdGyde Server needs to differentiate that the event is unique event, therefore events need to be added in console with specified type.

Please follow instructions below to create unique event
  1. Login into AdGyde Console
  2. Click on Setup/Events
  3. Click on 'create' button above events list
  4. Select your application on app_name field
  5. Enter 'GameLevelComplete' on event_id field. It should be the same as first parameter of AdGyde.onEvent(String, Map, Boolean flag)
  6. Enter 'Level' on parameter_name field
  7. Select 'Unique Event' item of comp_param_type field
  8. Click on 'Create' button



Monetisation


Monetisation compromises of two parts
  1. In-app Revenue
  2. Cost

In-app Revenue
In-app revenue is a type of revenue which is generated by any type of in-app events. The In-app revenue is considered suitable to measure campaign performance.

How to setup In-App Revenue Event

Suppose the App Developer may create a new in-app purchase event on the purchase screen and creates a deep link to the purchase screen. It then starts a campaign. User clicks on the tracking link for the in-app event and makes a purchase. The App Developer may then measure campaign performance and make suitable payments.

The App Developer generally regards in-app revenue as suitable parameter to measure and evaluate the campaign performance.
  1. The App Developer assigns a revenue event and sets value of Diwali Gift to Rs.50 in code
  2. Implement the deep linking functionality in your application
  3. login into AdGyde Console
  4. Create a Campaign for this promotion along with Deep Linking and deferred Deep Linking functionality to take the user directly to Purchase screen
  5. When User Has the Application then he is taken to Purchase screen but if user doesn’t have application the Application is installed and then taken to Purchase screen
  6. In console we can see the Revenue generated from this campaign

Cost
AdGyde also helps the advertiser to setup the cost of each campaign in the panel while creating the campaign. On setting this option, the advertiser can come to know what amount to be pay to each partner as per campaign. Calculation is simple on AdGyde’s side - Multiply the cost with the installs generated from campaign

The comparison between the cost and the revenue generated through single campaign can make it easy to judge the profitability of users acquired through the channel and campaign.



Cohort Analysis


AdGyde's Cohort report provides an ability to view and compare different metrics per multiple cohorts over different time-frames. Input filter conditions like date range, version, location and channels can be used to segment user count, also daily / weekly revenue trend as per the valuable users can be viewed on Console.

To compare the user quality per city for a Geo based campaign follow these steps
  1. Login to the AdGyde Console
  2. Select the Application from the list of clients
  3. Select the conditions:
    1. Select date range
    2. Select the campaign name
    3. Keep City Name as All
  4. Select 'city' option to use for group by
  5. Click Query to populate the Data
  6. Console shows cohort report as line chart:
    1. Y axis: Session Count
    2. X axis: Date

Campaign Tracking


As per the definition, campaign tracking refers to method to keep track from where the installs are coming. Campaign tracking helps to analyze new users, returning users, In-app events, In-app revenues generated for the Ad networks and publishers.

To track the installs from a specific partner, the partner should be integrated with AdGyde. In case the partner is not added, please contact support@adgyde.com and we will help your partner to get onboard in no time.

Once the partner is integrated with AdGyde, now you can go ahead and setup the campaign through console.

Steps to setup campaign
  1. Log in to the AdGyde console
  2. Go to Campaign Tracking under Setup heading in the Left Navigation Bar
  3. Create a new campaign for the publisher using "New Campaign" button
  4. Selects the Application for which the campaign is required
  5. Enters the campaign name
  6. Select the desired click Attribution Window
  7. Save campaign settings
  8. Click on Add Button under channel from the campaign list to finish campaign configuration
  9. Select 'The Channel / Publisher' from the integrated partners list
  10. Select Campaign Type, Cost for the campaign
  11. In case custom parameters are required same can be configured in tracking URL
  12. AdGyde console creates tracking URL as 'http://log2.adgyde.com/intf/b/1/u?c=20190514123454&p=123&clickid={clickid}'
  13. Select if Install post back is required or not - Tick the checkbox for "Enable S2S Install post back"
  14. Configure in-app events which will be sent to the publisher. Enter the publisher event token as event value
  15. If Deep Linking is required in the application same also can be configured here, "Enable Deep Linking"
  16. Select the Scheme, Class Name for Activity and Data to be passed, the code below can be copied to the manifest directly
  17. Save the campaign and share the tracking URL with the publisher

How it works
Once the publisher gets the tracking link with the desired parameters, he can use the same to bundle and create its own Campaign URL to give it further to sub-publishers. No Parameter is mandatory but without at least 1 parameter the postback will not be useful. Publisher needs to make sure that the click id is generated at their end and same is passed to AdGyde Tracking URL so that the same can be returned back in postback for exact match.

Tracking URL supports multiple parameters which are listed below
  1.   {clickid} = Click id
  2.   {pub} = Publisher / Sub-Publisher running the campaign
  3.   {cost} = Cost incurred by Advertiser for this campaign
  4.   {sub1} = Custom Parameter 1
  5.   {sub2} = Custom Parameter 2
  6.   {sub3} = Custom Parameter 3
  7.   {sub4} = Custom Parameter 4

When a user clicks on the Publishers URL, Publishers server replaces the Click id and other parameter values in AdGyde URL. AdGyde URL is then hit, AdGyde Server takes note of the details sent and opens the application page in Google Play Store with the provided details. The same details thereafter are passed to AdGyde SDK and returned back to Publisher through postback when required.

AdGyde Tracking URL :
http://log2.adgyde.com/intf/b/1/u?c=20190514862311&p=1046&clickid={clickid}&cost={Cost}&pub={Publisher}&sub1={sub1}&sub2={sub2}&sub3={sub3}&sub4={sub4}



Uninstall Tracking



AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

1. Requirements
An Android application with AdGyde SDK integrated. Also, Firebase Project's Server Key for the same application

Notes:-
  1. Uninstalls tracking is supported from Android SDK version 3.1.0
  2. If you are using multiple InstanceIDListener services, you can create your own Listener and pass the token to AdGyde's API


2. Steps to Enable AdGyde's Uninstall Tracking

2.1. Application Without Firebase Messaging
If your android application is not using Firebase Messaging Service, then follow below instructions:

  • Get your Firebase project's Server Key (Section 3)
  • Enter the Server Key to your AdGyde's dashboard. (Section 4)
  • Configure Firebase Messaging on your app. (Section 5)
  • Add the following code to your application as described:
  • Add the Firebase Dependency to your app's build.gradle file, as the following:

    dependencies {
    // . . .
    implement 'com.google.firebase:firebase-messaging:19.0.1'
    // . . .
    }

  • Add these lines to your app's AndroidManifest.xml file, inside the application tag:

    <application
    <!-- ... -->
    <service android:name="com.adgyde.android.FIIDService" exported="false" >
    <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
    </service>
    <!-- ... -->
    </application>

2.2. Application with Firebase Messaging Integrated
If you have Firebase Notifications integrated into your app, then follow these instructions:

  • Obtain your Firebase project's Server Key. (Section 3)
  • Enter the Server Key to your AdGyde dashboard. (Section 4)
  • Add the following code to your application as described:
  • In your InstanceIDListener Service's onTokenRefresh method (a class extending com.google.firebase.iid.FirebaseInstanceIdService), call our API inside the overridden method onTokenRefresh, as in the following example:

public class FIIDService extends FirebaseMessagingService {
private static final String TAG = "FIIDService";
@Override
public void onNewToken(String token) {
super.onNewToken(token);
try {
String refreshedToken = token;
if (!TextUtils.isEmpty(refreshedToken)){
AdGyde.onTokenRefresh(refreshedToken);
Log.d(TAG, "onTokenRefresh Refreshed token : " + refreshedToken);
}
} catch(Exception e){
e.printStackTrace();
}
}
}

3. Obtaining the Firebase Server Key
  1. Open the Firebase Console: https://console.firebase.google.com
  2. Create a Firebase Android Application project (if you have not already done so). For more information, visit this link: https://firebase.google.com/docs/notifications/android/console-audience#add_firebase_to_your_app
  3. After the project is created, open the project page by selecting the project from all the listed projects
  4. Navigate to the Project Settings (click on the cogwheel next to Overview on the left pane of the page)
  5. Under the Cloud Messaging tab, you can see your Sender ID which you may be using for FCM / GCM) and two Server Keys as shown below



  6. Make Note of Server Key (The Long Key and not the Legacy Server Key), which will be input in AdGyde's dashboard for uninstall tracking

4. Entering the Server Key on AdGyde's Dashboard
  1. Login to AdGyde Console
  2. Click on Setup -> Uninstall left navigation menu.

  3. Input the Firebase Server Key, which you had copied / noted in previous section in the area provided


5. Configure Firebase-Messaging on your Application
Follow the below steps as listed, or alternatively visit the firebase integration link by Google
https://firebase.google.com/docs/cloud-messaging/android/client

  1. Download your project's JSON file: google-services.json and saved it under your application's module directory. If you do not have this file, you can download it from your Project Settings in the Firebase Console
  2. Add the Firebase-Messaging dependencies to your project. Add rules to your root-level build.gradle file to include the google-services plugin:

    buildscript {
    // ...
    dependencies {
    // ...
    classpath 'com.google.gms:google-services:4.3.0'
    // ADD THIS LINE HERE
    }
    }

  3. In module Gradle file (usually the app/build.gradle) of the project, add the apply plugin line at the bottom of the file to enable the Gradle plugin, and add also the dependency inside the dependencies block

    apply plugin: 'com.android.app'
    android {
    // ...
    }

    dependencies {
    // ...
    compile 'com.google.firebase:firebase-messaging:19.0.1'
    // ADD THIS LINE AT THE BOTTOM OF THIS BLOCK
    }
    .
    .
    .
    apply plugin: 'com.google.gms.google-services'
    // ADD THIS LINE AT THE BOTTOM OF THIS FILE

    In case "Could not find.." error is encountered, make sure you have the latest Google Repository in the Android SDK Manager to resolve the same

6. Using ProGaurd with Uninstall Tracking
If your project is using ProGaurd, you need to take care that AdGyde SDK functions and Google Firebase Messaging Service functions do not get obfuscated, for same following rule exceptions need to be added in ProGaurd file

-dontwarncom.adgyde.android.**
-keep public class com.google.firebase.iid.FirebaseInstanceId {
public *;
}


7. Testing Android Uninstall Tracking
Testing of uninstall tracking is quite simple.
Whether the android application is live on Google Play or pending submission or even if out of store, the test will remain the same - just uninstall the app from the device.

It takes up to 24 hours for the new app’s uninstall event to be displayed on the uninstall trends section of the Dashboard.




AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

1. Requirements
An Android application with AdGyde SDK integrated. Also, Firebase Project's Server Key for the same application

Notes:-
  1. Uninstalls tracking is supported from Android SDK version 3.1.0
  2. If you are using multiple InstanceIDListener services, you can create your own Listener and pass the token to AdGyde's API


2. Steps to Enable AdGyde's Uninstall Tracking

2.1. Application Without Firebase Messaging
If your android application is not using Firebase Messaging Service, then follow below instructions:

  • Get your Firebase project's Server Key (Section 3)
  • Enter the Server Key to your AdGyde's dashboard. (Section 4)
  • Configure Firebase Messaging on your app. (Section 5)
  • Add the following code to your application as described:
  • Add the Firebase Dependency to your app's build.gradle file, as the following:

    dependencies {
    // . . .
    implement 'com.google.firebase:firebase-messaging:19.0.1'
    // . . .
    }

  • Add these lines to your app's AndroidManifest.xml file, inside the application tag:

    <application
    <!-- ... -->
    <service android:name="com.adgyde.android.FIIDService" exported="false" >
    <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
    </service>
    <!-- ... -->
    </application>

2.2. Application with Firebase Messaging Integrated
If you have Firebase Notifications integrated into your app, then follow these instructions:

  • Obtain your Firebase project's Server Key. (Section 3)
  • Enter the Server Key to your AdGyde dashboard. (Section 4)
  • Add the following code to your application as described:
  • In your InstanceIDListener Service's onTokenRefresh method (a class extending com.google.firebase.iid.FirebaseInstanceIdService), call our API inside the overridden method onTokenRefresh, as in the following example:

public class GameInit : MonoBehaviour {

void Start() {
//Init_Method for FCM client side();
AdgydeManager.SharedInstance.InitialiseFirebase();

// Used for with FCM
StartCoroutine(StartFCMService(20.0f));
}

public void InitialiseFirebase() {
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenRecieved;
Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageRecieved;
}

public void OnTokenRecieved(object sender, Firebase.Messaging.TokenReceivedEventArgs token) {
AdgydeManager.SharedInstance.Token = token.Token.ToString();
Debug.Log("UNITY : FCM Token "+ AdgydeManager.SharedInstance.Token);
StartCoroutine(CallDelay(45.0f));
}

public void OnMessageRecieved(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {
Debug.Log("Received a new message from : " + e.Message.From);
}

IEnumerator CallDelay(float waitTime) {
Debug.Log("UNITY : In delay Method ");
yield return new WaitForSeconds(waitTime);

Debug.Log("UNITY : In delay Method After 2.5f");

AdgydeManager.SharedInstance.getUserID();
DebugLog.text = AdgydeManager.SharedInstance.UserID;
AdgydeManager.SharedInstance.AdgydeToken();
}

public void getUSERID() {
AdgydeManager.SharedInstance.getUserID();
DebugLog.text = AdgydeManager.SharedInstance.UserID;
AdgydeManager.SharedInstance.AdgydeToken();
}
}

For more details see the link below. "https://firebase.google.com/docs/cloud-messaging/unity/client"

3. Obtaining the Firebase Server Key
  1. Open the Firebase Console: https://console.firebase.google.com
  2. Create a Firebase Android Application project (if you have not already done so). For more information, visit this link: https://firebase.google.com/docs/notifications/android/console-audience#add_firebase_to_your_app
  3. After the project is created, open the project page by selecting the project from all the listed projects
  4. Navigate to the Project Settings (click on the cogwheel next to Overview on the left pane of the page)
  5. Under the Cloud Messaging tab, you can see your Sender ID which you may be using for FCM / GCM) and two Server Keys as shown below



  6. Make Note of Server Key (The Long Key and not the Legacy Server Key), which will be input in AdGyde's dashboard for uninstall tracking

4. Entering the Server Key on AdGyde's Dashboard
  1. Login to AdGyde Console
  2. Click on Setup -> Uninstall left navigation menu.

  3. Input the Firebase Server Key, which you had copied / noted in previous section in the area provided


5. Configure Firebase-Messaging on your Application
Follow the below steps as listed, or alternatively visit the firebase integration link by Google
https://firebase.google.com/docs/cloud-messaging/android/client

  1. Download your project's JSON file: google-services.json and saved it under your application's module directory. If you do not have this file, you can download it from your Project Settings in the Firebase Console
  2. Add the Firebase-Messaging dependencies to your project. Add rules to your root-level build.gradle file to include the google-services plugin:

    buildscript {
    // ...
    dependencies {
    // ...
    classpath 'com.google.gms:google-services:4.3.0'
    // ADD THIS LINE HERE
    }
    }

  3. In module Gradle file (usually the app/build.gradle) of the project, add the apply plugin line at the bottom of the file to enable the Gradle plugin, and add also the dependency inside the dependencies block

    apply plugin: 'com.android.app'
    android {
    // ...
    }

    dependencies {
    // ...
    compile 'com.google.firebase:firebase-messaging:19.0.1'
    // ADD THIS LINE AT THE BOTTOM OF THIS BLOCK
    }

    In case "Could not find.." error is encountered, make sure you have the latest Google Repository in the Android SDK Manager to resolve the same

6. Using ProGaurd with Uninstall Tracking
If your project is using ProGaurd, you need to take care that AdGyde SDK functions and Google Firebase Messaging Service functions do not get obfuscated, for same following rule exceptions need to be added in ProGaurd file

-dontwarncom.adgyde.android.**
-keep public class com.google.firebase.iid.FirebaseInstanceId {
public *;
}


7. Testing Android Uninstall Tracking
Testing of uninstall tracking is quite simple.
Whether the android application is live on Google Play or pending submission or even if out of store, the test will remain the same - just uninstall the app from the device.

It takes up to 24 hours for the new app’s uninstall event to be displayed on the uninstall trends section of the Dashboard.




AdGyde's Uninstall Tracking functionality allows you to track the number of uninstalls for a specified application. Uninstalls is an important index which helps you to track the quality of users and hence the campaign.

1. Requirements
An Android application with AdGyde SDK integrated. Also, Firebase Project's Server Key for the same application

Notes:-
  1. Uninstalls tracking is supported from Android SDK version 3.1.0
  2. If you are using multiple InstanceIDListener services, you can create your own Listener and pass the token to AdGyde's API


2. Steps to Enable AdGyde's Uninstall Tracking

2.1. Application Without Firebase Messaging
If your android application is not using Firebase Messaging Service, then follow below instructions:

  • Get your Firebase project's Server Key (Section 3)
  • Enter the Server Key to your AdGyde's dashboard. (Section 4)
  • Configure Firebase Messaging on your app. (Section 5)
  • Add the following code to your application as described:
  • Add the Firebase Dependency to your app's build.gradle file, as the following:

    dependencies {
    // . . .
    implement 'com.google.firebase:firebase-messaging:19.0.1'
    // . . .
    }

  • Add these lines to your app's AndroidManifest.xml file, inside the application tag:

    <application
    <!-- ... -->
    <service android:name="com.adgyde.android.FIIDService" exported="false" >
    <intent-filter>
    <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
    </service>
    <!-- ... -->
    </application>

2.2. Application with Firebase Messaging Integrated
If you have Firebase Notifications integrated into your app, then follow these instructions:

  • Obtain your Firebase project's Server Key. (Section 3)
  • Enter the Server Key to your AdGyde dashboard. (Section 4)
  • Add the following code to your application as described:
  • In your index.js create the onFcmToken() function and call the onFcmToken from document.addEventListener, as in the following example:

function onFcmToken()
{
//FCMPlugin.onTokenRefresh( onTokenRefreshCallback(token));
//Note that this callback will be fired every time a new token is generated, including the first time.
FCMPlugin.onTokenRefresh(
function(token){
window.plugins.toast.showShortBottom('tokenrefresh-----',
function(a) {
console.log('Token---Success ' + token)
},
function(b) {
alert('toast error: ' + token)
}
);
}
);

//FCMPlugin.getToken( successCallback(token), errorCallback(err) );
//Keep in mind the function will return null if the token has not been established yet.
FCMPlugin.getToken(
function(token){
AdGydeTracker.onFcmToken(token);
window.plugins.toast.showShortBottom('getToken-----',
function(a) {
console.log('Token Success: ' + token)
},
function(b) {
alert('toast error: ' + token)
}
);
}
);
}


3. Obtaining the Firebase Server Key
  1. Open the Firebase Console: https://console.firebase.google.com
  2. Create a Firebase Android Application project (if you have not already done so). For more information, visit this link: https://firebase.google.com/docs/notifications/android/console-audience#add_firebase_to_your_app
  3. After the project is created, open the project page by selecting the project from all the listed projects
  4. Navigate to the Project Settings (click on the cogwheel next to Overview on the left pane of the page)
  5. Under the Cloud Messaging tab, you can see your Sender ID which you may be using for FCM / GCM) and two Server Keys as shown below



  6. Make Note of Server Key (The Long Key and not the Legacy Server Key), which will be input in AdGyde's dashboard for uninstall tracking

4. Entering the Server Key on AdGyde's Dashboard
  1. Login to AdGyde Console
  2. Click on Setup -> Uninstall left navigation menu.

  3. Input the Firebase Server Key, which you had copied / noted in previous section in the area provided


5. Configure Firebase-Messaging on your Application
Follow the below steps as listed, or alternatively visit the firebase integration link by Google
https://firebase.google.com/docs/cloud-messaging/android/client

  1. Download your project's JSON file: google-services.json and saved it under your application's module directory. If you do not have this file, you can download it from your Project Settings in the Firebase Console
  2. Add the Firebase-Messaging dependencies to your project. Add rules to your root-level build.gradle file to include the google-services plugin:

    buildscript {
    // ...
    dependencies {
    // ...
    classpath 'com.google.gms:google-services:4.3.0'
    // ADD THIS LINE HERE
    }
    }

  3. In module Gradle file (usually the app/build.gradle) of the project, add the apply plugin line at the bottom of the file to enable the Gradle plugin, and add also the dependency inside the dependencies block

    apply plugin: 'com.android.app'
    android {
    // ...
    }

    dependencies {
    // ...
    compile 'com.google.firebase:firebase-messaging:19.0.1'
    // ADD THIS LINE AT THE BOTTOM OF THIS BLOCK
    }

    In case "Could not find.." error is encountered, make sure you have the latest Google Repository in the Android SDK Manager to resolve the same

6. Using ProGaurd with Uninstall Tracking
If your project is using ProGaurd, you need to take care that AdGyde SDK functions and Google Firebase Messaging Service functions do not get obfuscated, for same following rule exceptions need to be added in ProGaurd file

-dontwarncom.adgyde.android.**
-keep public class com.google.firebase.iid.FirebaseInstanceId {
public *;
}


7. Testing Android Uninstall Tracking
Testing of uninstall tracking is quite simple.
Whether the android application is live on Google Play or pending submission or even if out of store, the test will remain the same - just uninstall the app from the device.

It takes up to 24 hours for the new app’s uninstall event to be displayed on the uninstall trends section of the Dashboard.