Builder
@objc(AASDKAdswizzAdRequestBuilder)
public class Builder : NSObject, Identifiable
Builder class for AdRequest
.
-
The unique identifier for this
Builder
.Declaration
Swift
public let objectId: UUID
-
The HTTP protocol. The default is
.https
.Declaration
Swift
@objc public func with(httpProtocol: HTTPProtocol) -> Builder
Parameters
httpProtocol
HTTP protocol
Return Value
the same builder object
-
Set VAST version. As of AdswizzSDK v7.12.0, the default is 4.1.
Declaration
Swift
@objc public func with(vastVersion: VASTVersion) -> Builder
Parameters
vastVersion
vastVersion description
Return Value
the same builder object
-
Set a single zone to the builder.
Declaration
Swift
@objc public func with(zone: AdswizzAdZone) -> Builder
Parameters
zone
a single zone description
Return Value
the same builder object
-
Set one or more zones on which the request will be made. Mandatory. Note that the order of the zones will be used by the Adswizz ad server during ad selection. For a single
AdswizzAdZone
, consider usingwith(zone:)
instead.Declaration
Swift
@objc public func with(zones: [AdswizzAdZone]) -> Builder
Parameters
zones
zone descriptions
Return Value
the same builder object
-
Set the configuration for “shim” ads. Optional. By specifying an
AdswizzShimZone
, the request will append the shims configuration to the list of zones and instruct the Adswizz AdServer to pad the adpod as necesarry to fulfill the duration requirement. e.g For livestream ad replacement use-case, the total duration of returned ads in the ad pod should be at least the requested size, not less. “shim” ads are used to pad as needed and to fill up any gaps in duration.Declaration
Swift
@objc public func with(shim: AdswizzShimZone) -> Builder
Parameters
shim
configuration for the “shim” ads
Return Value
the same builder object
-
Set the maximum total duration of ads to be selected, in seconds. Optional.
Declaration
Swift
@objc public func with(duration: TimeInterval) -> Builder
Parameters
duration
non-zero duration description in seconds
Return Value
the same builder object
-
Set the zone alias referencing an external zone. Optional.
Declaration
Swift
@objc public func with(zoneAlias: String) -> Builder
Parameters
zoneAlias
zoneAlias description
Return Value
the same builder object
-
Set the companion zone ids. Optional.
Deprecated from v7.12.0 and up. Use
with(companionZoneIds: [Int])
instead. Alternatively, consider usingwith(companionZoneAliases: [String])
if you need to set strings (non numerical values) as companion zones identifier. Contact your Technical Account Manager for more details.Declaration
Swift
@available(*, deprecated, message: "Please use either .with(companionZoneIds: [Int]﹚ or .with(companionZoneAliases: [String]﹚ to set the companion zones on the request.") @objc public func with(companionZones: String?) -> Builder
Parameters
companionZones
a string which represents a comma separated list of numerical values (CSV format)
Return Value
the same builder object
-
Set the companion zone ids. Optional. Note that it is mutually exclusive with
with(companionZoneAliases: [String])
. Use one or the other, not both, otherwise the Builder will throw an error.Declaration
Swift
@objc public func with(companionZoneIds: [Int]) -> Builder
Parameters
companionZoneIds
companion zones identifiers with a list of (numerical) ids
Return Value
same builder object
-
Set the companion zone aliases. Optional. Note that it is mutually exclusive with
with(companionZoneIds: [Int])
. Use one or the other, not both, otherwise the Builder will throw an error.Declaration
Swift
@objc public func with(companionZoneAliases: [String]) -> Builder
Parameters
companionZoneAliases
companion zones identifiers with a list of aliases
Return Value
same builder object
-
Set the tags used for requesting the ads. Optional.
Declaration
Swift
@objc public func with(tagsArray: String?) -> Builder
Parameters
tagsArray
string with tags separated by comma
Return Value
the same builder object
-
Set a referrer. Optional.
Declaration
Swift
@objc public func with(referrer: String?) -> Builder
Parameters
referrer
referrer description
Return Value
the same builder object
-
Set the Adswizz ad server. Mandatory.
Declaration
Swift
@objc public func with(server: String) -> Builder
Parameters
server
Adswizz server
Return Value
the same builder object.
-
Set and pass additional custom parameters to
AdswizzAdRequest
. Optional. Note that it should only be used at the recommendation of AdsWizz. All parameters must be URL encoded.Declaration
Swift
@objc public func with(additionalCustomParameters: String?) -> Builder
Parameters
additionalCustomParameters
custom parameters with a suggested format of
key1=value1&key2=value2
Return Value
the same builder object
-
Set and pass custom analytics data used for all
AnalyticsEvent
entries. Optional. Must be set before callingbuild()
.Declaration
Swift
@objc public func with(analyticsCustomData: AnalyticsCustomData?) -> Builder
Parameters
analyticsCustomData
custom parameters appended to all
AnalyticsEvent
entriesReturn Value
the same builder object
-
Set a TCFv2 string as described by IAB’s Transparency and Consent Framework (TCF). Optional.
Declaration
Swift
@objc public func with(userConsentV2: String?) -> Builder
Parameters
userConsentV2
a valid TCFv2 string
Return Value
the same builder object
-
When setting the
maxAds
value for anAdswizzAdZone
, the Adswizz server will try to respond with that number of ads. However, when it cannot fulfill that request, by settingenableExpectedAdsReporting
to true, the SDK will calculate the difference between the number of expected ads (maxAds) and the number of ads from the response and it will determine how many empty ads there are: numberOfEmptyAds = totalMaxAds - adsFromResponseFor each empty
AdData
, the SDK will fire the error tracking URLs viaadManager(_ adManager: AdManager, ad: AdData, trackingErrorUrls errorCode: VastErrorCode) -> [URL]
fromAdManagerDatasource
. By default,enableExpectedAdsReporting
is set to false.Note that totalMaxAds also takes into account zones that didn’t configure a specific
maxAds
, in which case every such zone will count as +1 towards the total number of expected ads.Declaration
Swift
@objc public func with(enableExpectedAdsReporting: Bool) -> Builder
Parameters
enableExpectedAdsReporting
whether or not reporting the expected ad count is enabled
Return Value
the same builder object
-
Builds an
AdswizzAdRequest
objectThrows
a missing zone ID error if it was not provided, or a server address is missingDeclaration
Swift
@objc public func build() throws -> AdswizzAdRequest
Return Value
a valid
AdswizzAdRequest
object