# Facebook

1.  Import the FAN [SDK](https://developers.facebook.com/docs/audience-network/download) to your project.

    **(iOS app can skip step 2 to 3)**
2. Create the package `com.intowow.sdk` under your app's project.
3. Add `CustomEventUtil` to `com.intowow.sdk`.
4.  Add corresponding custom event class (as below) to your project in iOS or `com.intowow.sdk` in android:

    **For InStream**

    * | Android Custom Event Class Name | iOS Custom Event Class Name   |
      | ------------------------------- | ----------------------------- |
      | FacebookCustomEventInStream     | CEFANInStreamCustomEvent.h/.m |
    *   **For Native**

        | Android Custom Event Class Name | iOS Custom Event Class Name |
        | ------------------------------- | --------------------------- |
        | FacebookCustomEventNative       | CEFANNativeCustomEvent.h/.m |
    *   **For Banner**

        | Android Custom Event Class Name | iOS Custom Event Class Name |
        | ------------------------------- | --------------------------- |
        | FacebookCustomEventCard         | CEFANBannerCustomEvent.h/.m |
    *   **For Interstitial**

        | Android Custom Event Class Name | iOS Custom Event Class Name       |
        | ------------------------------- | --------------------------------- |
        | FacebookCustomEventInterstitial | CEFANInterstitialCustomEvent.h/.m |
    *   **For Rewarded Video**

        | Android Custom Event Class Name  | iOS Custom Event Class Name        |
        | -------------------------------- | ---------------------------------- |
        | FacebookCustomEventRewardedVideo | CEFANRewardedVideoCustomEvent.h/.m |
5. Please provide **Facebook placement** to Intowow Account manager to enable FAN mediation.
6. Verified Audience Network SDK Version iOS: `Audience Network SDK 4.99.3` Android: `Audience Network SDK 4.99.3`
7. Ad Format Mapping

| Ad Format     | Facebook Ad Format  |
| ------------- | ------------------- |
| InStream      | In-Stream Video Ads |
| RewardedVideo | Rewarded Video Ads  |
| Native        | Native Ads          |
| Card          | Banner Ads          |
| Interstitial  | Interstitial Ads    |

## Note:

* Facebook audience network do not support video progress, mute and unmute information
* To follow[ facebook guideline](https://developers.facebook.com/docs/audience-network/guidelines/native-ads). If you are using the native format, be sure to attach the privacy information icon.

iOS

```objectivec
if ([customEventExtra[@"provider"] isEqualToString:@"FAN"]) {
    UIImageView *iconImageView = [self.nativeAd getCustomEventAsset:@"privacy_information_icon"];
    if (iconImageView) {
         // TODO: Attach privacyInformationIcon into your ad view. 
    }
}
```

Android:

```java
if (provider.equals("FAN")) {
    Object privacyInformationIcon = mNativeAd.getCustomEventAsset("privacy_information_icon");
    if (privacyInformationIcon instanceof View) {
        // TODO: Attach privacyInformationIcon into your ad view. 
    }
}
```
