Prebid

@objcMembers
public class Prebid : NSObject

The Prebid class manages the configuration and initialization of the PrebidMobile SDK.

Public Properties (SDK)

  • The name of the bidder for AppNexus.

    Declaration

    Swift

    public static let bidderNameAppNexus: String
  • The name of the bidder for Rubicon Project.

    Declaration

    Swift

    public static let bidderNameRubiconProject: String
  • Indicates whether the timeout value has been updated.

    Declaration

    Swift

    public var timeoutUpdated: Bool
  • The Prebid Server account ID.

    Declaration

    Swift

    public var prebidServerAccountId: String
  • Enables or disables debug mode. ORTB: bidRequest.test

    Declaration

    Swift

    public var pbsDebug: Bool
  • Custom HTTP headers to be sent with requests.

    Declaration

    Swift

    public var customHeaders: [String : String]
  • Stored bid responses identified by bidder names.

    Declaration

    Swift

    public var storedBidResponses: [String : String]
  • This property is set by the developer when he is willing to assign the assetID for Native ad.

    Declaration

    Swift

    public var shouldAssignNativeAssetID: Bool
  • This property is set by the developer when he is willing to share the location for better ad targeting

    Declaration

    Swift

    public var shareGeoLocation: Bool
  • Set the desidered verbosity of the logs

    Declaration

    Swift

    public var logLevel: LogLevel { get set }
  • Array containing objects that hold External UserId parameters.

    Declaration

    Swift

    public var externalUserIdArray: [ExternalUserId]
  • The singleton instance of the Prebid class.

    Declaration

    Swift

    public static let shared: Prebid
  • The version of the PrebidMobile SDK.

    Declaration

    Swift

    public var version: String { get }
  • The version of the OM SDK.

    Declaration

    Swift

    public var omsdkVersion: String { get }

Public Properties (Prebid)

  • The host for the Prebid Server.

    Declaration

    Swift

    public var prebidServerHost: PrebidHost { get set }
  • Custom status endpoint for the Prebid Server.

    Declaration

    Swift

    public var customStatusEndpoint: String? { get set }
  • Timeout for Prebid requests in milliseconds.

    Declaration

    Swift

    public var timeoutMillis: Int { get set }
  • Dynamic timeout value.

    Declaration

    Swift

    public var timeoutMillisDynamic: NSNumber?
  • Stored auction response.

    Declaration

    Swift

    public var storedAuctionResponse: String?

Public Properties (SDK)

  • Indicates whether the PBS should cache the bid for the rendering API. If the value is true the SDK will make the cache request in order to report the impression event respectively to the legacy analytic setup.

    Declaration

    Swift

    public var useCacheForReportingWithRenderingAPI: Bool
  • Controls how long each creative has to load before it is considered a failure.

    Declaration

    Swift

    public var creativeFactoryTimeout: TimeInterval
  • Controls how long video and interstitial creatives have to load before it is considered a failure.

    Declaration

    Swift

    public var creativeFactoryTimeoutPreRenderContent: TimeInterval
  • Controls whether to use PrebidMobile’s in-app browser or the Safari App for displaying ad clickthrough content.

    Declaration

    Swift

    public var useExternalClickthroughBrowser: Bool
  • Indicates the type of browser opened upon clicking the creative in an app, where embedded = 0, native = 1. Describes an OpenRTB imp.clickbrowser attribute.

    Declaration

    Swift

    public var impClickbrowserType: ClickbrowserType
  • If set to true, the output of PrebidMobile’s internal logger is written to a text file. This can be helpful for debugging. Defaults to false.

    Declaration

    Swift

    public var debugLogFileEnabled: Bool { get set }
  • If true, the SDK will periodically try to listen for location updates in order to request location-based ads.

    Declaration

    Swift

    public var locationUpdatesEnabled: Bool { get set }
  • If true, the sdk will add includewinners flag inside the targeting object described in PBS Documentation

    Declaration

    Swift

    public var includeWinners: Bool
  • If true, the sdk will add includebidderkeys flag inside the targeting object described in PBS Documentation

    Declaration

    Swift

    public var includeBidderKeys: Bool

Public Methods

  • Sets a custom Prebid Server URL.

    Throws

    An error if setting the custom host URL fails.

    Declaration

    Swift

    public func setCustomPrebidServer(url: String) throws

    Parameters

    url

    The custom Prebid Server URL.

Stored Bid Response

  • Adds a stored bid response.

    Declaration

    Swift

    public func addStoredBidResponse(bidder: String, responseId: String)

    Parameters

    bidder

    The name of the bidder.

    responseId

    The response ID.

  • Clears all stored bid responses.

    Declaration

    Swift

    public func clearStoredBidResponses()
  • Retrieves stored bid responses.

    Declaration

    Swift

    public func getStoredBidResponses() -> [[String : String]]?

    Return Value

    An array of dictionaries containing stored bid responses, or nil if there are none.

Custom Headers

  • Adds a custom HTTP header.

    Declaration

    Swift

    public func addCustomHeader(name: String, value: String)

    Parameters

    name

    The name of the header.

    value

    The value of the header.

  • Clears all custom HTTP headers.

    Declaration

    Swift

    public func clearCustomHeaders()
  • Initializes PrebidMobile SDK.

    Checks the status of Prebid Server. The customStatusEndpoint property is used as server status endpoint. If customStatusEndpoint property is not provided, the SDK will use default endpoint - host + /status. The host value is obtained from Prebid.shared.prebidServerHost.

    Checks the version of GMA SDK. If the version is not supported - logs warning.

    Use this SDK initializer if you’re using PrebidMobile with GMA SDK.

    Declaration

    Swift

    public static func initializeSDK(_ gadMobileAdsObject: AnyObject? = nil, _ completion: PrebidInitializationCallback? = nil)

    Parameters

    gadMobileAdsObject

    GADMobileAds object

    completion

    returns initialization status and optional error

  • Initializes PrebidMobile SDK.

    Checks the status of Prebid Server. The customStatusEndpoint property is used as server status endpoint. If customStatusEndpoint property is not provided, the SDK will use default endpoint - host + /status. The host value is obtained from Prebid.shared.prebidServerHost.

    Checks the version of GMA SDK. If the version is not supported - logs warning.

    Use this SDK initializer if you’re using PrebidMobile with GMA SDK.

    Declaration

    Swift

    public static func initializeSDK(gadMobileAdsVersion: String? = nil, _ completion: PrebidInitializationCallback? = nil)

    Parameters

    gadMobileAdsVersion

    GADMobileAds version string, use GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber) to get it

    completion

    returns initialization status and optional error

  • Initializes PrebidMobile SDK.

    Checks the status of Prebid Server. The customStatusEndpoint property is used as server status endpoint. If customStatusEndpoint property is not provided, the SDK will use default endpoint - host + /status. The host value is obtained from Prebid.shared.prebidServerHost.

    Use this SDK initializer if you’re using PrebidMobile without GMA SDK.

    Declaration

    Swift

    public static func initializeSDK(_ completion: PrebidInitializationCallback? = nil)

    Parameters

    completion

    returns initialization status and optional error

Private Methods