로딩중입니다
adbrix Facebook広告設定:Android/Unity Android
3/10/2016 11:13:48 AM

adbrix Facebook広告設定:Android・Unity


adbrixでFacebookアプリインストール(MAIA)とリエンゲージ(MAEA)広告を実施するための設定ガイドです。


*注意事項

    - この機能を利用するために、まずIGAW基本連携を完了してください。 「IGAW基本連携:Android 「IGAW基本連携:Unity Android」

    - Facebookの計測機能を利用するためには、 IgawCommon ver 4.2.0 以上を利用してください。



コード連携
1. ディープリンクの設定

Facebookの広告設定のためには、アプリ内のディープリンクの設定が必要となります。「Google Deep Link Guide」

アプリ内の特定ページにランディングできるpath値(Custom Query)を設定してください。

* キャンペーンを計測するトラッキングURL発行の際に、Deep link Schemeとランディングページのpath値が必要となります。




2. ディープリンク情報の取り込み

ディープリンクが設定されたFacebookキャンペーンを経由してアプリが起動されると、ディープリンクのPath情報が渡されるようになります。 渡されたディープリンクのPath情報を利用して希望するアクションを定義します。


#ケース1. Facebook SDKを連携していない場合

Facebook SDKを連携していない状況でIGAWorksのSDKだけ利用するケースです。
  • Android
//Facebook計測のためのAPIを追加
IgawCommon.setDeferredLinkListener(this, new DeferredLinkListener() {
    @Override
    public void onReceiveDeeplink(String s) {
        try {
            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));
    }



#ケース2. Facebook SDKを連携した場合

Facebook SDKの FetchDeferredAppLinkData APIの利用可否によって2つのケースがあります。各ケース別に設定を進めてください。 
* 以下のマニュアルを適用するためには、Common_v4.2.7 , Adbrix_v4.2.2 以上のバージョンを連携してください。 SDKダウンロードはこちら


#ケース2-1. FaceBook SDKの FetchDeferredAppLinkData APIを使用する場合

Facebook SDKのFetchDeferredAppLinkData APIを使用する場合、以下のマニュアルに従ってください。 

  • 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);
                //v. 4.2.5からsetReferralUrlがsetReferralUrlForFacebookに変更されます。
                //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がsetReferralUrlForFacebookに変更されます。
            IgaworksUnityPluginAOS.Common.setReferralUrlForFacebook(nativeURL);
} catch (Exception e) { Debug.Log("Error: " + e.Message); } } }


ケース2-2. FaceBook SDKのFetchDeferredAppLinkData APIを使用しない場合
Facebook SDKの FetchDeferredAppLinkData APIを使用しない場合は、#ケース1のマニュアルのように設定します。 



Facebookキャンペーンの設定及びテスト

Facebook広告のための設定やテストに関しては、以下のマニュアルよりご確認ください。

「adbrix : Facebookのアプリキャンペーンの設定」