Skip to main content

Ad Frequency Control

Ad frequency control (AFC) limits how often viewers see ads. With AFC, you set a simple rule: after a viewer has watched an ad break, no more ads play until they've watched a set amount of content.

Why use AFC​

AFC helps you balance ad revenue with viewer experience. Use it when you want to:

  • Avoid showing back-to-back ad breaks to the same viewer.
  • Give viewers an ad-free stretch of content after they've seen ads.
  • Tune ad pressure with a few settings, without changing your ad schedule.

AFC applies to Google IMA (CSAI & SSAI) and AWS MediaTailor.

Configure AFC​

The AdFrequencyControlConfiguration enables AFC and defines its thresholds. The following table lists the default values. Set enable to true to enforce AFC.

PropertyDefaultDescription
enablefalseTurns AFC on. When false, all ad opportunities play.
minimumContentConsumptionMs180_000 (3 minutes)Amount of content, in milliseconds, the viewer must watch after a qualified ad break before the next one can play.
adBreakExposureThreshold0.66Fraction of an ad break the viewer must watch for it to count as seen. 0.66 means 66%.
allowFirstOpportunitytrueAlways allows the first ad opportunity, such as the preroll, to play.

Use AFC with IMA CSAI​

Pass adFrequencyControl when constructing the ad player via FLAdvertisingGoogleIMAFactory:

import FLPlayer
import FLAdvertisingGoogleIMA

let adPlayer = FLAdvertisingGoogleIMAFactory.adPlayer(
contentPlayer: contentPlayer,
request: request,
shouldSupportPIP: shouldSupportPIP,
playerViewControllerCallback: playerViewControllerCallback,
adFrequencyControl: .init(
enable: true,
minimumContentConsumptionMs: 180_000,
adBreakExposureThreshold: 0.66,
allowFirstOpportunity: true
)
)
let adComposedPlayer = FLAdvertisingGoogleIMAFactory.adComposablePlayer(contentPlayer: contentPlayer, adPlayer: adPlayer)

Use AFC with IMA DAI​

For Google DAI streams initialized through FLAdvertisingGoogleIMAFactory, pass adFrequencyControl during ad player instantiation:

import FLPlayer
import FLAdvertisingGoogleIMA

let adPlayer = FLAdvertisingGoogleIMAFactory.adPlayer(
contentPlayer: contentPlayer,
request: daiAdRequest,
shouldSupportPIP: shouldSupportPIP,
playerViewControllerCallback: playerViewControllerCallback,
adFrequencyControl: .init(
enable: true,
minimumContentConsumptionMs: 180_000,
adBreakExposureThreshold: 0.66,
allowFirstOpportunity: true
)
)
let adComposedPlayer = FLAdvertisingGoogleIMAFactory.adComposablePlayer(contentPlayer: contentPlayer, adPlayer: adPlayer)

Use AFC with MediaTailor​

The MediaTailorPlayerBuilder supports AFC on both custom and Datazoom MediaTailor player modes. Configure AFC on MediaTailorPlayerBuilder using the .adFrequencyControl(configuration:) method:

import FLPlayer
import FLAdvertisingMediatailor

var builder = FLMediatailorFactory.createPlayerBuilder(mediatailorSession: session, fallbackAsset: urlAsset)
builder.adFrequencyControl(configuration: .init(
enable: true,
minimumContentConsumptionMs: 180_000,
adBreakExposureThreshold: 0.66,
allowFirstOpportunity: true
))
let player = builder.build()

Evaluate an ad opportunity in your app​

For SSAI, the ad decision can happen before the player exists, for example during content authorization. In that case, call AdFrequencyControl.shared.evaluateOpportunity() to ask AFC whether an ad opportunity is currently allowed. It returns true if the opportunity is allowed or false if AFC suppresses it. When AFC is disabled, it returns true.

Use the result for whatever your app needs. For example, you can skip an SSAI preroll request, tag the session, or write a log entry.

import FLPlayer

if AdFrequencyControl.shared.evaluateOpportunity() {
// The opportunity is allowed. For example, request the SSAI preroll.
} else {
// The opportunity is suppressed. For example, skip the request or log it.
}

Ad suppression event​

When AFC blocks an ad opportunity, the player emits the adSkipAfcPolicy event. Use this event to identify ads skipped because of AFC policy, and report it to analytics for tracking and downstream analysis.

Logging and diagnostics​

AFC logs diagnostic events under the com.quickplay.FLPlayer subsystem with the AFC category. Filter for category:AFC in Xcode Console or macOS Console to monitor:

  • Configuration updates and parameter values
  • Content consumption accumulation ticks and seek discards
  • Ad opportunity evaluations (allowed or suppressed)
  • Exposure threshold completions and counter resets

AFC at a glance​

The following example uses the default settings:

  1. A viewer starts a video. AFC allows the first ad opportunity, so the preroll plays.
  2. The viewer watches at least 66% of the ad break. AFC counts this as a qualified ad impression.
  3. For the next 3 minutes of content, AFC skips any scheduled ad break. The viewer watches without interruption.
  4. After the viewer has watched 3 minutes of content, the next ad break plays.

If the viewer leaves or skips an ad break before reaching 66%, AFC doesn't count it as seen. The next ad break plays as scheduled.

How AFC applies to each playback type​

AFC remembers what a viewer has watched, and it keeps that memory when the viewer moves from one video to the next. For example, a viewer who finishes an ad break at the end of one episode doesn't get another ad right at the start of the next episode. AFC does this by keeping a single, shared record of ad exposure and content watched across playback sessions.

How AFC uses that record depends on the playback type:

Playback typeWhat AFC does
VODTracks viewing and decides. AFC allows or suppresses each ad break based on the viewer's history.
LIVETracks viewing only. Ads are stitched into the stream dynamically, so AFC doesn't suppress them.

The tracked data from all types feeds the same record. For example, an ad break that plays through LIVE still counts toward the viewer's exposure. A later VOD uses that record to decide whether to play ad or not.