TDAdRequestURLBuilder Class Reference

Inherits from NSObject
Declared in TDAdRequestURLBuilder.h

Overview

TDAdRequestURLBuilder helps to build ad requests for Triton’s on-demand banners and interstitials (pre-roll, mid-roll), including targeting parameters and device capabilities specified in Triton’s On-Demand Advertising Guide.

It also includes the user’s IDFA (Id for Advertisers), when available, and can also incluse the user’s GPS location to better target the ads. The url’s generated or TDAdRequestURLBuilder itself can be passed directly to TDAdLoader.

Creating a TDAdRequestURLBuilder

+ builderWithHostURL:

Creates and initializes a request url builder.

+ (instancetype)builderWithHostURL:(NSString *)url

Parameters

url

the base url for the request url builder (the ad server url)

Return Value

an instance of the request url builder

Declared In

TDAdRequestURLBuilder.h

– initWithHostURL:

Initializes a newly allocated a request url builder

- (instancetype)initWithHostURL:(NSString *)url

Parameters

url

the base url for the request url builder (the ad server url)

Return Value

an instance of the request url builder

Declared In

TDAdRequestURLBuilder.h

Defining the ad type

  adType

Defines the type of ad requested (preroll, midroll). The default value is preroll. There’s no need to be defined for banner ads, just for interstitials.

@property (nonatomic, assign) TDAdType adType

Declared In

TDAdRequestURLBuilder.h

Required parameters

  stationId

Either the Station ID or station name must be specified when calling the On-Demand Ad Request Service. While both IDs and names are supported, it is strongly recommended that clients use the station ID.

@property (nonatomic, assign) NSInteger stationId

Discussion

If both ID and name are provided, the name is used (there is no validation check that the ID matches the name). Triton Digital assigns station IDs and names when setting up a station.

Declared In

TDAdRequestURLBuilder.h

  stationName

Station names are case-sensitive. See stationId.

@property (nonatomic, copy) NSString *stationName

Declared In

TDAdRequestURLBuilder.h

Location targeting

  postalCode

The postal/zip code of the listener. Must be a valid postal or zip code, without spaces. E.g., 89040 or H3G1R8. When using this property, it’s recommended to also use country.

@property (nonatomic, copy) NSString *postalCode

Declared In

TDAdRequestURLBuilder.h

  country

The ISO 3166-1 alpha-2 two-letter country code (e.g., US). If using this property, it’s recommended to also use postalCode.

@property (nonatomic, copy) NSString *country

Declared In

TDAdRequestURLBuilder.h

– setLocationWithLatitude:andLongitude:

The latitude and longitude of the listener obtained from CoreLocation or other source.

- (void)setLocationWithLatitude:(float)latitude andLongitude:(float)longitude

Parameters

latitude

float value between -90.0 and 90.0.

longitude

float value between -180.0 and 180.0

Declared In

TDAdRequestURLBuilder.h

  latitude

The latitude of the listener obtained from CoreLocation or other source. Floating-point value: -90.0 to 90.0. Not required individually. If using, you must also specify longitude.

@property (nonatomic, assign) float latitude

Declared In

TDAdRequestURLBuilder.h

  longitude

The longitude of the listener obtained from CoreLocation or other source. Floating-point value: -180.0 to 180.0. Not required individually. If using, you must also specify latitude.

@property (nonatomic, assign) float longitude

Declared In

TDAdRequestURLBuilder.h

  autoLocationTrackingEnabled

Whether to use built-in Core Location manager to handle location. Default value is NO. When enabled it will override values obtained from setLocationWithLatitude:andLongitude

@property (nonatomic, getter=isAutoLocationTrackingEnabled) BOOL autoLocationTrackingEnabled

Declared In

TDAdRequestURLBuilder.h

Demographic targeting

  age

Integer value: 1 to 125

@property (nonatomic, assign) NSInteger age

Declared In

TDAdRequestURLBuilder.h

  dateOfBirth

The date of birth as an NSDate

@property (nonatomic, copy) NSDate *dateOfBirth

Declared In

TDAdRequestURLBuilder.h

– setDateOfBirthFromString:

Set the date of birth as a string formatted as YYYY-MM-DD

- (void)setDateOfBirthFromString:(NSString *)dateOfBirth

Parameters

dateOfBirth

the formatted string

Declared In

TDAdRequestURLBuilder.h

  yearOfBirth

Integer value: 1900 to 2005

@property (nonatomic, assign) NSInteger yearOfBirth

Declared In

TDAdRequestURLBuilder.h

  gender

Possible values are kTDGenderFemale and kTDGenderMale

@property (nonatomic, assign) TDGender gender

Declared In

TDAdRequestURLBuilder.h

  bundleId

Application package name e.g com.tritondigital.tritonradio

@property (nonatomic, assign) NSString *bundleId

Declared In

TDAdRequestURLBuilder.h

  storeId

App Store identifier

@property (nonatomic, assign) NSString *storeId

Declared In

TDAdRequestURLBuilder.h

  storeUrl

App store url

@property (nonatomic, assign) NSString *storeUrl

Declared In

TDAdRequestURLBuilder.h

Banner capabilities

  banners

A string with a list of comma-separated banner sizes

@property (nonatomic, copy) NSString *banners

Discussion

Players can provide details on their level of support for banners, such as banner sizes and formats.

The ordering of the capability formats is not important.

Note: Before attempting to use player capability targeting, please contact the Triton Digital Support Team to enable Player Capability Targeting for your broadcaster. Currently, Player Capability Targeting only works with Tap advertising.

Supported Formats

CapabilityDescription
970x250 IAB Billboard (970x250)
120x60 IAB Button 2 (120x60)
300x600 IAB Half Page/Filmstrip (300x600)
728x90 IAB Leaderboard (728x90)
970x100 IAB Leaderboard (970x100)
300x250 IAB Medium Rectangle (300x250)
88x31 IAB Microbar (88x31)
300x1050 IAB Portrait (300x1050)
970x90 IAB Pushdown (970x90)
180x150 IAB Rectangle (180x150)
320x480 IAB Smartphone Portrait (320x480)
300x50 IAB Smartphone Static Banner (300x50)
320x50 IAB Smartphone Static Wide Banner (320x50)
300x300 IAB Square (300x300)
970x66 IAB Super Leaderboard (970x66)
160x600 IAB Wide Skyscraper (160x600)
Client-defined (w x h)Custom banner size

Declared In

TDAdRequestURLBuilder.h

  customSegmentId

Integer value: 1 to 1000000

@property (nonatomic, assign) NSInteger customSegmentId

Discussion

Broadcasters that want to differentiate their listeners into custom broadcaster-specific segments may use the Custom Segment Targeting capability of Tap.

Note: Before use by players, please contact the Triton Digital Support Team to enable Custom Segment ID Targeting for your broadcaster. Currently, Custom Segment ID Targeting only works with Tap advertising.

Declared In

TDAdRequestURLBuilder.h

Asset constraints

  assetType

Change this if you would like to impose constraints on the type of asset returned. Possible values are: kTDAssetTypeNotDefined, kTDAssetTypeAudio, kTDAssetTypeVideo and kTDAssetTypeAudioVideo.

@property (nonatomic, assign) TDAssetType assetType

Declared In

TDAdRequestURLBuilder.h

  extraParameters

All the parameters non supported by properties can be passed by key/value pair. Situations in which you would use this property: - When defining Asset Constraints (Section 3.3.5 of Triton’s On-Demand Advertising guide); - Custom parameters - New supported targeting parameters without a corresponding propery. - Standard parameters can also be passed using this dictionary and they will override the values set by each property or setter method.

@property (nonatomic, copy) NSDictionary *extraParameters

Declared In

TDAdRequestURLBuilder.h

  TTags

An Array of NSString - When defining Custom TTag Targeting

@property (nonatomic, copy) NSArray *TTags

Declared In

TDAdRequestURLBuilder.h

  dmpSegments

A dictionary containing the DMP Segments that will be added

@property (nonatomic, strong) NSDictionary *dmpSegments

Declared In

TDAdRequestURLBuilder.h

Generating the Ad request URL

– generateAdRequestURL

Build and return a string containing the ad request URL for on-demand ads.

- (NSString *)generateAdRequestURL

Return Value

NSString containing the ad request. It will return nil if host is not specified and if both station name and station id are not specified.

Declared In

TDAdRequestURLBuilder.h

– reset

Resets the TDAdRequestURLBuiler to its default values and keeps the host url. You can use this to reuse the same object for different requests to the same host.

- (void)reset

Declared In

TDAdRequestURLBuilder.h