CustomAudience.Builder


class CustomAudience.Builder


Builder for CustomAudience objects.

Summary

Public constructors

Builder(
    buyer: AdTechIdentifier,
    name: String,
    dailyUpdateUri: Uri,
    biddingLogicUri: Uri,
    ads: List<AdData>
)

Public functions

CustomAudience

Builds an instance of a CustomAudience.

CustomAudience.Builder
setActivationTime(activationTime: Instant)

On creation of the CustomAudience object, an optional activation time may be set in the future, in order to serve a delayed activation.

CustomAudience.Builder

This list of AdData objects is a full and complete list of the ads that will be served by this CustomAudience during the ad selection process.

CustomAudience.Builder
setBiddingLogicUri(biddingLogicUri: Uri)

Returns the target URI used to fetch bidding logic when a custom audience participates in the ad selection process.

CustomAudience.Builder

Sets the buyer AdTechIdentifier.

CustomAudience.Builder
setDailyUpdateUri(dailyUpdateUri: Uri)

This URI points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process.

CustomAudience.Builder
setExpirationTime(expirationTime: Instant)

Once the expiration time has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process.

CustomAudience.Builder
setName(name: String)

Sets the CustomAudience object's name.

CustomAudience.Builder
setTrustedBiddingData(trustedBiddingSignals: TrustedBiddingData)

Trusted bidding data consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with.

CustomAudience.Builder

User bidding signals are optionally provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment.

Public constructors

Builder

Added in 1.0.0
Builder(
    buyer: AdTechIdentifier,
    name: String,
    dailyUpdateUri: Uri,
    biddingLogicUri: Uri,
    ads: List<AdData>
)

Public functions

build

Added in 1.0.0
fun build(): CustomAudience

Builds an instance of a CustomAudience.

setActivationTime

Added in 1.0.0
fun setActivationTime(activationTime: Instant): CustomAudience.Builder

On creation of the CustomAudience object, an optional activation time may be set in the future, in order to serve a delayed activation. If the field is not set, the CustomAudience will be activated at the time of joining.

For example, a custom audience for lapsed users may not activate until a threshold of inactivity is reached, at which point the custom audience's ads will participate in the ad selection process, potentially redirecting lapsed users to the original owner application.

The maximum delay in activation is 60 days from initial creation.

If specified, the activation time must be an earlier instant than the expiration time.

Parameters
activationTime: Instant

activation time, truncated to milliseconds, after which the CustomAudience will serve ads.

setAds

Added in 1.0.0
fun setAds(ads: List<AdData>): CustomAudience.Builder

This list of AdData objects is a full and complete list of the ads that will be served by this CustomAudience during the ad selection process.

If not specified, or if an empty list is provided, the CustomAudience will not participate in ad selection until a valid list of ads are provided via the daily update for the custom audience.

Parameters
ads: List<AdData>

a List of AdData objects representing ads currently served by the custom audience.

setBiddingLogicUri

Added in 1.0.0
fun setBiddingLogicUri(biddingLogicUri: Uri): CustomAudience.Builder

Returns the target URI used to fetch bidding logic when a custom audience participates in the ad selection process. The URI must use HTTPS.

Parameters
biddingLogicUri: Uri

the URI for fetching buyer bidding logic

setBuyer

Added in 1.0.0
fun setBuyer(buyer: AdTechIdentifier): CustomAudience.Builder

Sets the buyer AdTechIdentifier.

Parameters
buyer: AdTechIdentifier

A buyer is identified by a domain in the form "buyerexample.com".

setDailyUpdateUri

Added in 1.0.0
fun setDailyUpdateUri(dailyUpdateUri: Uri): CustomAudience.Builder

This URI points to a buyer-operated server that hosts updated bidding data and ads metadata to be used in the on-device ad selection process. The URI must use HTTPS.

Parameters
dailyUpdateUri: Uri

the custom audience's daily update URI

setExpirationTime

Added in 1.0.0
fun setExpirationTime(expirationTime: Instant): CustomAudience.Builder

Once the expiration time has passed, a custom audience is no longer eligible for daily ad/bidding data updates or participation in the ad selection process. The custom audience will then be deleted from memory by the next daily update.

If no expiration time is provided on creation of the CustomAudience, expiry will default to 60 days from activation.

The maximum expiry is 60 days from initial activation.

Parameters
expirationTime: Instant

the timestamp Instant, truncated to milliseconds, after which the custom audience should be removed.

setName

Added in 1.0.0
fun setName(name: String): CustomAudience.Builder

Sets the CustomAudience object's name.

Parameters
name: String

The custom audience's name is an arbitrary string provided by the owner and buyer on creation of the CustomAudience object.

setTrustedBiddingData

Added in 1.0.0
fun setTrustedBiddingData(trustedBiddingSignals: TrustedBiddingData): CustomAudience.Builder

Trusted bidding data consists of a URI pointing to a trusted server for buyers' bidding data and a list of keys to query the server with. Note that the keys are arbitrary identifiers that will only be used to query the trusted server for a buyer's bidding logic during ad selection.

If not specified, the CustomAudience will not participate in ad selection until trusted bidding data are provided via the daily update for the custom audience.

Parameters
trustedBiddingSignals: TrustedBiddingData

a TrustedBiddingData object containing the custom audience's trusted bidding data.

setUserBiddingSignals

Added in 1.0.0
fun setUserBiddingSignals(userBiddingSignals: AdSelectionSignals): CustomAudience.Builder

User bidding signals are optionally provided by buyers to be consumed by buyer-provided JavaScript during ad selection in an isolated execution environment.

If the user bidding signals are not a valid JSON object that can be consumed by the buyer's JS, the custom audience will not be eligible for ad selection.

If not specified, the CustomAudience will not participate in ad selection until user bidding signals are provided via the daily update for the custom audience.

Parameters
userBiddingSignals: AdSelectionSignals

an AdSelectionSignals object representing the user bidding signals for the custom audience