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) -> BuilderParameters
httpProtocolHTTP 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) -> BuilderParameters
vastVersionvastVersion description
Return Value
the same builder object
-
Set a single zone to the builder.
Declaration
Swift
@objc public func with(zone: AdswizzAdZone) -> BuilderParameters
zonea 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]) -> BuilderParameters
zoneszone 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) -> BuilderParameters
shimconfiguration 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) -> BuilderParameters
durationnon-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) -> BuilderParameters
zoneAliaszoneAlias 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?) -> BuilderParameters
companionZonesa 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]) -> BuilderParameters
companionZoneIdscompanion 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]) -> BuilderParameters
companionZoneAliasescompanion 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?) -> BuilderParameters
tagsArraystring with tags separated by comma
Return Value
the same builder object
-
Set a referrer. Optional.
Declaration
Swift
@objc public func with(referrer: String?) -> BuilderParameters
referrerreferrer description
Return Value
the same builder object
-
Set the Adswizz ad server. Mandatory.
Declaration
Swift
@objc public func with(server: String) -> BuilderParameters
serverAdswizz 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?) -> BuilderParameters
additionalCustomParameterscustom parameters with a suggested format of
key1=value1&key2=value2Return Value
the same builder object
-
Set and pass custom analytics data used for all
AnalyticsEvententries. Optional. Must be set before callingbuild().Declaration
Swift
@objc public func with(analyticsCustomData: AnalyticsCustomData?) -> BuilderParameters
analyticsCustomDatacustom parameters appended to all
AnalyticsEvententriesReturn 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?) -> BuilderParameters
userConsentV2a valid TCFv2 string
Return Value
the same builder object
-
When setting the
maxAdsvalue for anAdswizzAdZone, the Adswizz server will try to respond with that number of ads. However, when it cannot fulfill that request, by settingenableExpectedAdsReportingto 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,enableExpectedAdsReportingis 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) -> BuilderParameters
enableExpectedAdsReportingwhether or not reporting the expected ad count is enabled
Return Value
the same builder object
-
Builds an
AdswizzAdRequestobjectThrows
a missing zone ID error if it was not provided, or a server address is missingDeclaration
Swift
@objc public func build() throws -> AdswizzAdRequestReturn Value
a valid
AdswizzAdRequestobject