Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

These instructions give an overview of integrating the MobileFuse SDK with your iOS app.

Integration Steps Overview

  1. Download the MobileFuse iOS SDK

  2. Initialize the SDK

  3. Configure ad units to display ads

Step 1. Download the MobileFuse iOS SDK

The MobileFuse SDK is distributed on CocoaPods.

Podfile setup

Update your project’s podfile to include the MobileFuse SDK

source 'https://github.com/CocoaPods/Specs.git'
target 'MyApp' do
  pod 'MobileFuseSDK'
end

Once you have run pod install you should then be able to include the MobileFuse SDK in your app, using the following import statement:

@import MobileFuseSDK;

Step 2. Initialize the SDK

To initialize the SDK, you’ll need to provide a valid App ID.

If you don’t have an App ID for the SDK, please ask your MobileFuse contact. You’ll be given a unique App ID for each app and each platform that you publish to.

🧪 Internal Testing

You can use the following App IDs for testing:

Publisher ID: 3068

App ID: 10914

Before initialization, you should also configure data privacy settings for your app user.

Configure data privacy

The MobileFuse SDK supports privacy configurations that can be managed using an IAB compatible US Privacy String, and IAB Consent Framework strings for GDPR. You can also notify the SDK whether your user subject to COPPA, due to them being under 13 years of age.

The following snippet demonstrates configuration for the US privacy and COPPA compliance:

MobileFusePrivacyPreferences *privacyPreferences = [[MobileFusePrivacyPreferences alloc] init];
[privacyPreferences setSubjectToCoppa:NO]; // Shound be YES if user is under 13 years of age
[privacyPreferences setUsPrivacyConsentString:@"<US Privacy String>"]; // e.g. 1YNN

[MobileFuse setPrivacyPreferences:privacyPreferences];

GDPR for European users

For your European users, you must supply an IAB-compatible privacy consent string. The following example shows how to declare consent for a user which is subject to GDPR due to being located in an EAA country. Note that this can simply be chained to the same MobileFusePrivacyPreferences.Builder() as above.

MobileFusePrivacyPreferences *privacyPreferences = [[MobileFusePrivacyPreferences alloc] init];
[privacyPreferences setIabConsentString:@"<IAB Consent String>"];

[MobileFuse setPrivacyPreferences:privacyPreferences];

To ensure that you get reliable ad fill and the best CPMs, please ensure that you implement the data privacy methods that are relevant to your user.

🧪 Internal Testing

Here are some opted-in consent strings that you can use for internal testing:

US Privacy: 1YNN

EU IAB Consent String: CPJB6bHPJB6bHK3AAAENBiCAAAAAAAAAAAAAHGwAQHGgAAAA.IIENf_X__bX9n-_79__t0eY1f9_r_v-Qzjhfdt-8N2L_W_L0X_2E7NF36pq4KuR4ku3bBIQNtHMnUTUmx6olVrzPsak2Mr7NKJ7LkmnsZe2dYGHtfn91T-ZKZ7_7__9f73z_______9_3____________-_____9____________9__w

App Tracking and Transparency Framework

You must also ensure that you have implemented the Apple App Tracking and Transparency Framework into your app before you set up any of your ad units. This sample code shows how you can request the authorization. If authorization has already been granted, then the callback will immediately fire with the correct status, therefore it’s advisable to call the requestTrackingAuthorizationWithCompletionHandler method every time your app launches.

#import <AppTrackingTransparency/AppTrackingTransparency.h>

// ...

- (void)requestAppTracking {
    [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
        switch (status) {
            case ATTrackingManagerAuthorizationStatusNotDetermined:
                NSLog(@"ATT - Request not determined");
                break;
            case ATTrackingManagerAuthorizationStatusRestricted:
                NSLog(@"ATT - Request restricted");
                break;
            case ATTrackingManagerAuthorizationStatusDenied:
                NSLog(@"ATT - Request denied");
                break;
            case ATTrackingManagerAuthorizationStatusAuthorized:
                NSLog(@"ATT - Request authorized");
                break;
        }
        
        // Run the initialization on our main thread:
        dispatch_async(dispatch_get_main_queue(), ^{
            [self initMobileFuseSdk];
        });
    }];
}

Initialize the SDK

The following code snippet demonstrates a simple SDK initialization. Passing in the delegate is optional, but it will allow you to handle the onInitSuccess and onInitFail callbacks.

// ...

- (void)viewDidLoad {
    [super viewDidLoad];
    [self requestAppTracking]; // Will call initMobileFuseSdk when ATT has been resolved.
}

- (void)initMobileFuseSdk {
    [MobileFuse init:self.view withAppId:@"10914" withPublisherId:@"3068" withDelegate:self];
}

// IMFInitializationCallbackReceiver delegate implementation
- (void)onInitSuccess:(NSString *)appId withPublisherId:(NSString *)publisherId {
    NSLog(@"SDK Initialization successful");
}

- (void)onInitFailed:(NSString *)message {
    NSLog(@"SDK Initialization failed: %@", message);
}

🧪 Internal Testing

You won’t receive test ads unless you override some settings in the SDK! You should override these settings before you create your first ad unit, so it’s safest to place them right at the top of your code within your main activity’s onCreate method. We have some undocumented methods that allow you to modify how the SDK interacts with the ad server:

Ensure you import the hidden MobileFuseSettings file before using these methods: #import <MobileFuseSDK/MobileFuseSettings.h>

  1. Configure the app to use a testing IFA - this is a special IFA that will receive test ads:
    [MobileFuseSettings setOverride:MOBILEFUSE_SETTING_IFA withValue:@"2C0B92BE-2850-41BE-86EB-549684CD647A"];

  2. Optionally configure the app to use a custom IP address - you can use this to pretend that you’re somewhere that you’re not, e.g. for testing GDPR within EU:
    [MobileFuseSettings setOverride:MOBILEFUSE_SETTING_IP_ADDRESS withValue:@"46.208.0.0"]; // UK IP to test GDPR

Step 3. Create Ad Units

Once the SDK has initialized, you can start using MobileFuse ad units. The following guides provide steps to get started with each of our supported ad formats:

🧪 Internal Testing

Here are some test placement IDs that you can use!

  • Interstitial: Rich-media only - 418284

  • Interstitial: Video only - 418285

  • Interstitial: Mixed - 418286

  • Banner: 418311

  • Transparent Interstitial: 418646

  • Pull-Tab: 418647

  • No labels