CustomAudience.Builder


public final class CustomAudience.Builder


Builder for CustomAudience objects.

Summary

Public constructors

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

Public methods

final @NonNull CustomAudience

Builds an instance of a CustomAudience.

final @NonNull 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.

final @NonNull 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.

final @NonNull CustomAudience.Builder
setBiddingLogicUri(@NonNull Uri biddingLogicUri)

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

final @NonNull CustomAudience.Builder

Sets the buyer AdTechIdentifier.

final @NonNull CustomAudience.Builder
setDailyUpdateUri(@NonNull Uri dailyUpdateUri)

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.

final @NonNull 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.

final @NonNull CustomAudience.Builder

Sets the CustomAudience object's name.

final @NonNull 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.

final @NonNull 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
public Builder(
    @NonNull AdTechIdentifier buyer,
    @NonNull String name,
    @NonNull Uri dailyUpdateUri,
    @NonNull Uri biddingLogicUri,
    @NonNull List<@NonNull AdData> ads
)

Public methods

build

Added in 1.0.0
public final @NonNull CustomAudience build()

Builds an instance of a CustomAudience.

setActivationTime

Added in 1.0.0
public final @NonNull CustomAudience.Builder setActivationTime(@NonNull Instant activationTime)

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
@NonNull Instant activationTime

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

setAds

Added in 1.0.0
public final @NonNull CustomAudience.Builder setAds(@NonNull List<@NonNull AdData> ads)

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
@NonNull List<@NonNull AdData> ads

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

setBiddingLogicUri

Added in 1.0.0
public final @NonNull CustomAudience.Builder setBiddingLogicUri(@NonNull Uri biddingLogicUri)

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
@NonNull Uri biddingLogicUri

the URI for fetching buyer bidding logic

setBuyer

Added in 1.0.0
public final @NonNull CustomAudience.Builder setBuyer(@NonNull AdTechIdentifier buyer)

Sets the buyer AdTechIdentifier.

Parameters
@NonNull AdTechIdentifier buyer

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

setDailyUpdateUri

Added in 1.0.0
public final @NonNull CustomAudience.Builder setDailyUpdateUri(@NonNull Uri dailyUpdateUri)

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
@NonNull Uri dailyUpdateUri

the custom audience's daily update URI

setExpirationTime

Added in 1.0.0
public final @NonNull CustomAudience.Builder setExpirationTime(@NonNull Instant expirationTime)

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
@NonNull Instant expirationTime

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

setName

Added in 1.0.0
public final @NonNull CustomAudience.Builder setName(@NonNull String name)

Sets the CustomAudience object's name.

Parameters
@NonNull String name

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
public final @NonNull CustomAudience.Builder setTrustedBiddingData(@NonNull TrustedBiddingData trustedBiddingSignals)

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
@NonNull TrustedBiddingData trustedBiddingSignals

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

setUserBiddingSignals

Added in 1.0.0
public final @NonNull CustomAudience.Builder setUserBiddingSignals(@NonNull AdSelectionSignals userBiddingSignals)

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
@NonNull AdSelectionSignals userBiddingSignals

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