로딩중입니다
Adbrix Facebook Ad Setting : iOS, Unity
5/2/2016 3:20:56 PM

Adbrix Facebook Ad Setting : iOS, 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: iOS] [IGAW General Integration: Unity iOS]
- IgawCore ver 2.2.2 or higer version for MAIA and IgaworksCore ver 2.3.2 for MAEA are required to use this feature.
- IDFA value must be registered to use this feature. [IGAW Apple IDFA Registration: iOS] [IGAW Apple IDFA Registration: Unity iOS]

* Update * IgaworksCore 2.2.2: Integration method is added in case of using Facebook SDK.



Code Integration

1. URL Scheme Path Setting

URL Scheme has to be set for Facebook 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.

  • iOS
@interface AppDelegate () <IgaworksCoreDelegate>

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

	[IgaworksCore shared].delegate = self;

	return YES;
}

#pragma mark - IgaworksCoreDelegate
//open url with deep link
- (void)didReceiveDeeplink:(NSString *)deepLink
{
    if (deepLink.length > 0) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:deepLink]];
    }
}
  • Unity
public class IgaworksSample : MonoBehaviour
{
	void Start ()
	{
		IgaworksCorePluginIOS.SetIgaworksCoreDelegate();
	}
	
	void Awake()
	{
		// add handle deep link event
		IgaworksCorePluginIOS.didReceiveDeeplink += HandleDidReceiveDeeplink;
	}
	
	void OnDisable()
	{
		IgaworksCorePluginIOS.didReceiveDeeplink -= HandleDidReceiveDeeplink;
	}

	// handle deep link event
	public void HandleDidReceiveDeeplink(string deepLink)
	{
		Debug.Log ("IgaworksSample : HandleDidReceiveDeeplink " + deepLink);

		// url open
	}

}


#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 Core2.2.2 version are required. [Download Center]


case2-1. In case of using FetchDeferredAppLinkData API

In case of using FetchDeferredAppLinkData API, please follow below guide.

  • iOS ( setReferralUrl API )

@interface AppDelegate () <IgaworksCoreDelegate>


@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

	[IgaworksCore shared].delegate = self;
      if (launchOptions[UIApplicationLaunchOptionsURLKey] == nil) {
        [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
          if (error) {
                NSLog(@"Received error while fetching deferred app link %@", error);
            }
            if (url) {
                NSLog(@"Facebook SDK: Received fetching deferred app link %@", url);
                [IgaworksCore setReferralUrl:url];

                // open the app with deeplink url
                [[UIApplication sharedApplication] openURL:url]; 
            }
        }];
    }
	return YES;
}

#pragma mark - IgaworksCoreDelegate
//open url with deep link
- (void)didReceiveDeeplink:(NSString *)deepLink
{
    NSLog(@"Received deeplink url %@", deepLink);
}

  • Unity ( SetReferralUrl API )
FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);

void DeepLinkCallback(IAppLinkResult result)
{
    if (!String.IsNullOrEmpty(result.Url))
    {
        IgaworksCorePluginIOS.SetReferralUrl(result.Url);
    }    
}


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]