Adbrix Facebook Ad Setting : Android, Unity
This is a guide for Mobile App Install Advertising(MAIA), Mobile App Engagement Advertising(MAEA) using adbrix.
*Warning
- IGAW Integration must be set before using this feature.
[IGAW General Integration: Android] [IGAW General Integration: Unity Android]
- Below is the requirements for SDK version.
a. Mobile App Install Advertising(MAIA) : Higher than IgawCommon ver 4.2.0
b. Mobile App Engagement Advertising (MAEA) : Higher than IgawCommon ver 4.2.1
Code Integration
1. Deep-linking setting
In-app deep-linking needs to be set for Facebook Ad tracking. [How to set Deeplink?]
Path value(system query value) to specific path inside the app must be set.
* Depp-link scheme and path value of landing page are required when you create adbrix tracking link for the ad.
2. Deep Link information
If the app is opened through Facebook advertising that deep link is set, Deep Link path information will be sent. Received Deep Link path will be passed to SDK.
#Case1. In case of not using Facebook SDK
If you don't use Facebook and use only IGAWorks SDK, please refer following guide.
- Android
IgawCommon.startApplication(MainActivity.this);
//add API for facebook ad setting
IgawCommon.setDeferredLinkListener(this, new DeferredLinkListener() {
@Override
public void onReceiveDeeplink(String s) {
try {Android( setReferralUrl API)
Log.i("IGAWORKS", "Facebook Deeplink: " + s);
Intent i = new Intent(Intent.ACTION_VIEW);
i.addCategory(Intent.CATEGORY_BROWSABLE);
i.setData(Uri.parse(s));
MainActivity.this.startActivity(i);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
- Unity
IgaworksUnityPluginAOS.Common.setDeferredLinkListener();
IgaworksUnityPluginAOS.OnReceiveDeferredLink = mOnReceiveDeferredLink;
void mOnReceiveDeferredLink(string deeplink)
{
Debug.Log(string.Format("mOnReceiveDeferredLink deeplink: {0}", deeplink));
}
#Case2. In case of usingFacebook SDK
In case of using Facebook SDK, there are two cases depends on using FetchDeferredAppLinkData API. Please follow the guide depends on each case.
* Higher than Common_v4.2.7, adbrix_v4.2.2 are required. [Download Center]
#case2-1. In case of using FetchDeferredAppLinkData API
In case of using FetchDeferredAppLinkData API, please follow below guide.
- Android( setReferralUrl API)
AppLinkData.fetchDeferredAppLinkData(MainActivity.this, new AppLinkData.CompletionHandler() {
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
try {
Bundle bundle = appLinkData.getArgumentBundle();
// Get deeplink from ApplinkData
String deeplink = bundle.getString(AppLinkData.ARGUMENTS_NATIVE_URL);
// Report deeplink for IgawCommon to get tracking parameters
//IgawCommon.setReferralUrl(MainActivity.this, deeplink);
//setReferralUrl changed to setReferralUrlForFacebook since v.4.2.5
//IgawCommon.setReferralUrlForFacebook(MainActivity.this, deeplink);
// Deeplinking
Intent i = new Intent(Intent.ACTION_VIEW);
i.addCategory(Intent.CATEGORY_BROWSABLE);
i.setData(Uri.parse(deeplink));
MainActivity.this.startActivity(i);
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
- Unity ( setReferralUrl API)
FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);
void DeepLinkCallback(IResult result)
{
Debug.Log("DeepLinkCallback call ");
if (result != null && !string.IsNullOrEmpty(result.RawResult))
{
try
{
Dictionary<string, object> jsonObjects = MiniJson.Deserialize(result.RawResult) as Dictionary<string, object>;
string extras = (string)jsonObjects["extras"];
Dictionary<string, object> extrasJSON = MiniJson.Deserialize(extras) as Dictionary<string, object>;
string nativeURL = (string)extrasJSON["com.facebook.platform.APPLINK_NATIVE_URL"];
// Report deeplink for IgawCommon to get tracking parameters
// IgaworksUnityPluginAOS.Common.setReferralUrl(nativeURL);
// setReferralUrl changed to setReferralUrlForFacebook
IgaworksUnityPluginAOS.Common.setReferralUrlForFacebook(nativeURL);
}
catch (Exception e)
{
Debug.Log("Error: " + e.Message);
}
}
}
case2-2. In case of not using FetchDeferredAppLinkData API
In case of not using FetchDeferredAppLinkData API, please follow guide above #Case1.
Facebook ad setting and test
We offer guides like how to create adbrix tracking link for Facebook ad, how to set Facebook ad, and how to test the Facebook ad on the article below.
[Track Ad Performance: Facebook Mobile App Install, Mobile App Ad]