Prebid

@objcMembers
public class Prebid : NSObject

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

Public Properties (SDK)

  • 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
  • The Prebid auction settings ID.

    Declaration

    Swift

    public var auctionSettingsId: 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]
  • Optional Delegate which returns Request and Response Data for further processing

    Declaration

    Swift

    public weak var eventDelegate: PrebidEventDelegate?
  • 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 }
  • 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)

  • 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
  • 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

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()
  • 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.

    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(
        serverURL: String,
        _ gadMobileAdsObject: AnyObject? = nil,
        _ completion: PrebidInitializationCallback? = nil) throws

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    gadMobileAdsObject

    GADMobileAds object

    completion

    returns initialization status and optional error

  • 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.

    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(
        serverURL: String,
        nonTrackingURLString: String,
        _ gadMobileAdsObject: AnyObject? = nil,
        _ completion: PrebidInitializationCallback? = nil) throws

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    nonTrackingURL

    The custom Prebid Server URL, used when a user rejected the app to track

    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.

    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(
        serverURL: String,
        gadMobileAdsVersion: String? = nil,
        _ completion: PrebidInitializationCallback? = nil) throws

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    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.

    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(
        serverURL: String,
        nonTrackingURLString: String,
        gadMobileAdsVersion: String? = nil,
        _ completion: PrebidInitializationCallback? = nil) throws

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    nonTrackingURL

    The custom Prebid Server URL, used when a user rejected the app to track

    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.

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

    Declaration

    Swift

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

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    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.

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

    Declaration

    Swift

    public static func initializeSDK(
        serverURL: String,
        nonTrackingURLString: String,
        _ completion: PrebidInitializationCallback? = nil) throws

    Parameters

    serverURL

    The custom Prebid Server URL, used when a user allowed the app to track

    nonTrackingURL

    The custom Prebid Server URL, used when a user rejected the app to track

    completion

    returns initialization status and optional error

Private Methods