Advanced SDK Configuration

The following methods are available to adjust the behavior of the SDK. You can call them any time before requesting ads.

Creative ID v1.7.2+

For debugging purposes, or at the request of your account manager, you can get the Creative ID (CRID) of a particular loaded ad instance by using the following methods:

MFWinningBidInfo *winningBidInfo = bannerAd.winningBidInfo; // From a banner ad instance for example
if (winningBidInfo != nil) {
    NSLog(@"CRID: %@", ad.winningBidInfo.creativeId); // Get the Creative ID
}
if let winningBidInfo = ad.winningBidInfo {
    print("CRID: \(winningBidInfo.creativeId ?? "Not set")")
}
WinningBidInfo bidInfo = bannerAd.getWinningBidInfo(); // From a banner ad instance for example
if (bidInfo != null) {
    logDebug("CRID: " + bidInfo.getCreativeId()); // Get the Creative ID
}

Note that it is also automatically logged in the device console for convenience (as Winning bid received with CRID: x).

User Age and Gender support v1.5.2+

The MobileFuse SDK now supports the OpenRTB standard 'gender' and 'year of birth' fields. You can optionally pass this information to the SDK using the following methods:

// Optionally set year of birth, or age. (age will be converted to an approximate year of birth):
[MobileFuseTargetingData setYearOfBirth:1980];
[MobileFuseTargetingData setAge:40];

// Optionally set the user gender:
[MobileFuseTargetingData setGender: MOBILEFUSE_TARGETING_DATA_GENDER_FEMALE]  // User is female
[MobileFuseTargetingData setGender: MOBILEFUSE_TARGETING_DATA_GENDER_MALE]    // User is male
[MobileFuseTargetingData setGender: MOBILEFUSE_TARGETING_DATA_GENDER_OTHER]   // Known to be other gender
[MobileFuseTargetingData setGender: MOBILEFUSE_TARGETING_DATA_GENDER_UNKNOWN] // Unset any previously set value
// Optionally set year of birth, or age. (age will be converted to an approximate year of birth):
MobileFuseTargetingData.yearOfBirth = 1980
MobileFuseTargetingData.age = 40

// Optionally set the user gender:
import com.mobilefuse.sdk.user.Gender

MobileFuseTargetingData.gender = Gender.FEMALE  // User is female
MobileFuseTargetingData.gender = Gender.MALE    // User is male
MobileFuseTargetingData.gender = Gender.OTHER   // Known to be other gender
MobileFuseTargetingData.gender = Gender.UNKNOWN // Unset any previously set value
// Optionally set year of birth, or age. (age will be converted to an approximate year of birth):
MobileFuseTargetingData.setYearOfBirth(1980);
MobileFuseTargetingData.setAge(40);

// Optionally set the user gender:
import com.mobilefuse.sdk.user.Gender

MobileFuseTargetingData.setGender(Gender.FEMALE);  // User is female
MobileFuseTargetingData.setGender(Gender.MALE);    // User is male
MobileFuseTargetingData.setGender(Gender.OTHER);   // Known to be other gender
MobileFuseTargetingData.setGender(Gender.UNKNOWN); // Unset any previously set value

Video Clickthrough Behavior v1.3.1 +

By default, video creatives will direct the user to the clickthrough location when the video creative or the CTA button is tapped.

You can adjust the behavior so that only the CTA “Learn More” button will be clickable. When configured in this way, tapping the video will have no effect unless the actual CTA button is tapped. Note that in v1.6.0+, this setting only takes effect if no server-side configuration is set for the placement by our team.

// Import required:
#import <MobileFuseSDK/MobileFuseSettings.h>

// Set the behavior to CTA Only:
[MobileFuseSettings setVideoClickthroughBehavior: VIDEO_CLICKTHROUGH_BEHAVIOR_CTA_ONLY];

// Set the behavior to CTA + Video (default):
[MobileFuseSettings setVideoClickthroughBehavior: VIDEO_CLICKTHROUGH_BEHAVIOR_CTA_AND_VIDEO];
// Set the behavior to CTA Only:
MobileFuseSettings.setVideoClickthroughBehaviour( ClickthroughBehaviour.CTA_ONLY );

// Set the behavior to CTA + Video (default):
MobileFuseSettings.setVideoClickthroughBehaviour( ClickthroughBehaviour.CTA_AND_VIDEO );

UID2 Opt-Out v1.6.4+

We have partner integrations within the MobileFuse SDK which offer an easy way to hook into LiveRamp RampID and Neustar's FabrickID for UID2-based user targeting.

If you would like to opt out of this, you can call methods in MobileFuseTargetingData before invoking any other SDK methods as in the following examples:

@import MobileFuseSDK;

// Disable Neustar partner integration (FabrickID)
[MobileFuseTargetingData setVendorEnabled:NO
    forVendor:MOBILEFUSE_TARGETING_DATA_PARTNER_NEUSTAR];

// Disable LiveRamp partner integration (RampID)
[MobileFuseTargetingData setVendorEnabled:NO 
  forVendor:MOBILEFUSE_TARGETING_DATA_PARTNER_LIVERAMP];

import MobileFuseSDK

// Disable Neustar partner integration (FabrickID)
MobileFuseTargetingData.setVendorEnabled(false,
    forVendor:MOBILEFUSE_TARGETING_DATA_PARTNER_NEUSTAR)

// Disable LiveRamp partner integration (RampID)
MobileFuseTargetingData.setVendorEnabled(false,
    forVendor:MOBILEFUSE_TARGETING_DATA_PARTNER_LIVERAMP)
// Disable Neustar partner integration (FabrickID)
MobileFuseTargetingData.setVendorEnabled(Partner.NEUSTAR, false);

// Disable LiveRamp partner integration (RampID)
MobileFuseTargetingData.setVendorEnabled(Partner.LIVERAMP, false);
// Disable Neustar partner integration (FabrickID)
MobileFuseTargetingData.setVendorEnabled(Partner.NEUSTAR, false)
  
// Disable LiveRamp partner integration (RampID)
MobileFuseTargetingData.setVendorEnabled(Partner.LIVERAMP, false)

Alternatively, you can add AndroidManifest.xml or Info.plist keys:

<key>MFVendorEnableLiveRamp</key>
<false/>
<key>MFVendorEnableNeustar</key>
<false/>
<!-- In your AndroidManifest.xml -->

<application ...>

<meta-data android:name="com.mobilefuse.sdk.vendor_enable_liveramp" android:value="false" />
<meta-data android:name="com.mobilefuse.sdk.vendor_enable_neustar" android:value="false" />

<activity ...
</application>

Manual Initialization v1.6.0+

As of SDK version 1.6.0, the MobileFuse SDK will automatically initialize itself. If you would rather take control of initialization, you can do so with the following instructions.

/*
  Note that the iOS SDK will automatically initialize when you call any method 
  from the MobileFuse class. To avoid automatic initialization, make sure the 
  initWithDelegate method is the first one you call.
*/

@import MobileFuseSDK

// Make your interface conform to the IMFInitializationCallbackReceiver delegate protocol
@interface ViewController () <IMFInitializationCallbackReceiver>
  
- (void)onInitSuccess:(NSString *)appId withPublisherId:(NSString *)publisherId;
- (void)onInitError:(NSString *)appId withPublisherId:(NSString *)publisherId withError:(MFAdError *)error;

@end

@implementation ViewController
  
 - (void)viewDidLoad {
    // Call init and set your delegate to get the onInitSuccess and onInitError callbacks
    [MobileFuse initWithDelegate:self];
}

- (void)onInitSuccess:(NSString *)appId withPublisherId:(NSString *)publisherId {
    // Init was a success! You can now call other methods from the MobileFuse class
}

- (void)onInitError:(NSString *)appId withPublisherId:(NSString *)publisherId withError:(MFAdError *)error {
    // Init failed. Handle error case
    NSLog(@"%@", error.message);
}

@end
<!-- In your AndroidManifest.xml -->

<application ...>

<!-- This meta-data with value "true" disables automatic MobileFuse SDK initialization after app launch -->
<meta-data android:name="com.mobilefuse.sdk.disable_auto_init" android:value="true" />

<activity ...
</application>

...
  
// When you want to initialize the SDK
  
MobileFuse.init( new SdkInitListener()
{
    @Override
    public void onInitSuccess()
    {
        // Init succeeded, do what you want to do here!
    }

    @Override
    public void onInitError()
    {
        // Init failed. Handle error case
    }
} );

Note that if you try to load an ad before calling the initialization method, the SDK will initialize itself before requesting an ad.