MediationNativeAdUnit

@objcMembers
public class MediationNativeAdUnit : NSObject

This class is responsible for making bid request and providing the winning bid and targeting keywords to mediating SDKs. This class is a part of Mediation API.

Public Properties

Public Methods

  • Initializes a new instance of the MediationNativeAdUnit with the specified configuration ID and mediation delegate.

    Declaration

    Swift

    public init(configId: String, mediationDelegate: PrebidMediationDelegate)

    Parameters

    configId

    The configuration ID for the ad unit.

    mediationDelegate

    The delegate for mediation-related tasks.

  • Adds event trackers to the native ad unit.

    Declaration

    Swift

    public func addEventTracker(_ eventTrackers: [NativeEventTracker])

    Parameters

    eventTrackers

    An array of NativeEventTracker objects to add.

  • Adds native assets to the native ad unit.

    Declaration

    Swift

    public func addNativeAssets(_ assets: [NativeAsset])

    Parameters

    assets

    An array of NativeAsset objects to add.

  • Sets the context type for the native ad unit.

    Declaration

    Swift

    public func setContextType(_ contextType: ContextType)

    Parameters

    contextType

    The context type to set.

  • Sets the placement type for the native ad unit.

    Declaration

    Swift

    public func setPlacementType(_ placementType: PlacementType)

    Parameters

    placementType

    The placement type to set.

  • Sets the placement count for the native ad unit.

    Declaration

    Swift

    public func setPlacementCount(_ placementCount: Int)

    Parameters

    placementCount

    The placement count to set.

  • Sets the context subtype for the native ad unit.

    Declaration

    Swift

    public func setContextSubType(_ contextSubType: ContextSubType)

    Parameters

    contextSubType

    The context subtype to set.

  • Sets the sequence for the native ad unit.

    Declaration

    Swift

    public func setSequence(_ sequence: Int)

    Parameters

    sequence

    The sequence to set.

  • Sets the asset URL support for the native ad unit.

    Declaration

    Swift

    public func setAssetURLSupport(_ assetURLSupport: Int)

    Parameters

    assetURLSupport

    The asset URL support value to set.

  • Sets the DURL support for the native ad unit.

    Declaration

    Swift

    public func setDURLSupport(_ dURLSupport: Int)

    Parameters

    dURLSupport

    The DURL support value to set.

  • Sets the privacy value for the native ad unit.

    Declaration

    Swift

    public func setPrivacy(_ privacy: Int)

    Parameters

    privacy

    The privacy value to set.

  • Sets the extended data for the native ad unit.

    Declaration

    Swift

    public func setExt(_ ext: [String : Any])

    Parameters

    ext

    A dictionary containing the extended data to set.

  • Retrieves the OpenRTB configuration for the native ad unit.

    Declaration

    Swift

    public func getOrtbConfig() -> String?

    Return Value

    The OpenRTB configuration as a string, or nil if not set.

  • Sets the OpenRTB configuration for the native ad unit.

    Declaration

    Swift

    public func setOrtbConfig(_ ortbConfig: String?)

    Parameters

    ortbConfig

    The OpenRTB configuration to set.

App Content (app.content.data)

  • Sets the app content object, replacing any existing content.

    Declaration

    Swift

    public func setAppContent(_ appContent: PBMORTBAppContent)

    Parameters

    appContent

    The PBMORTBAppContent object representing the app’s content.

  • Clears the current app content object.

    Declaration

    Swift

    public func clearAppContent()
  • Adds an array of content data objects to the app content.

    Declaration

    Swift

    public func addAppContentData(_ dataObjects: [PBMORTBContentData])

    Parameters

    dataObjects

    An array of PBMORTBContentData objects to add.

  • Removes a specific content data object from the app content.

    Declaration

    Swift

    public func removeAppContent(_ dataObject: PBMORTBContentData)

    Parameters

    dataObject

    The PBMORTBContentData object to remove.

User Data (user.data)

  • Adds an array of user data objects.

    Declaration

    Swift

    public func addUserData(_ userDataObjects: [PBMORTBContentData])

    Parameters

    userDataObjects

    An array of PBMORTBContentData objects to add to the user data.

  • Removes a specific user data object.

    Declaration

    Swift

    public func removeUserData(_ userDataObject: PBMORTBContentData)

    Parameters

    userDataObject

    The PBMORTBContentData object to remove from the user data.

  • Clears all user data.

    Declaration

    Swift

    public func clearUserData()

Ext Data (imp[].ext.data)

  • This method obtains the context data keyword & value for adunit context targeting if the key already exists the value will be appended to the list. No duplicates will be added

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use addExtData method instead.")
    public func addContextData(key: String, value: String)
  • This method obtains the context data keyword & values for adunit context targeting the values if the key already exist will be replaced with the new set of values

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use updateExtData method instead.")
    public func updateContextData(key: String, value: Set<String>)
  • This method allows to remove specific context data keyword & values set from adunit context targeting

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use removeExtData method instead.")
    public func removeContextData(forKey: String)
  • This method allows to remove all context data set from adunit context targeting

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use clearExtData method instead.")
    public func clearContextData()
  • This method obtains the ext data keyword & value for adunit targeting. If the key already exists the value will be appended to the list. No duplicates will be added

    Declaration

    Swift

    public func addExtData(key: String, value: String)
  • This method obtains the ext data keyword & values for adunit targeting. The values if the key already exist will be replaced with the new set of values

    Declaration

    Swift

    public func updateExtData(key: String, value: Set<String>)
  • This method allows to remove specific ext data keyword & values set from adunit targeting

    Declaration

    Swift

    public func removeExtData(forKey: String)
  • This method allows to remove all ext data set from adunit targeting

    Declaration

    Swift

    public func clearExtData()

Ext keywords (imp[].ext.keywords)

  • This method obtains the context keyword for adunit context targeting Inserts the given element in the set if it is not already present.

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use addExtKeyword method instead.")
    public func addContextKeyword(_ newElement: String)
  • This method obtains the context keyword set for adunit context targeting Adds the elements of the given set to the set.

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use addExtKeywords method instead.")
    public func addContextKeywords(_ newElements: Set<String>)
  • This method allows to remove specific context keyword from adunit context targeting

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use removeExtKeyword method instead.")
    public func removeContextKeyword(_ element: String)
  • This method allows to remove all keywords from the set of adunit context targeting

    Declaration

    Swift

    @available(*, deprecated, message: "This method is deprecated. Please, use clearExtKeywords method instead.")
    public func clearContextKeywords()
  • This method obtains the keyword for adunit targeting Inserts the given element in the set if it is not already present.

    Declaration

    Swift

    public func addExtKeyword(_ newElement: String)
  • This method obtains the keyword set for adunit targeting Adds the elements of the given set to the set.

    Declaration

    Swift

    public func addExtKeywords(_ newElements: Set<String>)
  • This method allows to remove specific keyword from adunit targeting

    Declaration

    Swift

    public func removeExtKeyword(_ element: String)
  • This method allows to remove all keywords from the set of adunit targeting

    Declaration

    Swift

    public func clearExtKeywords()
  • Makes bid request for the native ad unit and setups mediation parameters.

    Declaration

    Swift

    public func fetchDemand(completion: ((ResultCode) -> Void)?)

    Parameters

    completion

    The completion handler to call with the result code.