Secure signals

Secure signals are encoded data that is collected on the client device and shared with select bidders. This guide shows you how to collect and send secure signals to Google Ad Manager using the IMA SDK.

The secure signals API requires version 3.18.1 or higher of the IMA SDK for iOS.

To select signals and bidders, and enable secure signal sharing, see Share secure signals with bidders.

Use a third-party signal provider

To use secure signals, you must deploy a signal collector adapter class in your app to collect signals, encode them, and pass them to the IMA SDK.

Follow your third-party provider's instructions to set up an account with them, include frameworks, and set up their secure signals adapter in your app.

The IMA SDK for iOS automatically initializes each secure signals adapter, without any additional changes to your code.

Here's an example of how you might add a secure signals adapter to your project:

Send custom data

In addition to using a third-party signal provider, you can also collect, encode, and send signals with custom data. Before you can send secure signals with custom data, you must turn on custom signals in Ad Manager.

For each ad request, create an IMASecureSignals object containing your encoded custom data as a string. Then, add the IMASecureSignals object to your ad request by calling the IMAAdsRequest.secureSignals attribute.

Here are samples in Objective-C and Swift:

Objective-C

BasicExample/ViewController.m

...
- (void)requestAds {
  // Create an ad display container for ad rendering.
  IMAAdDisplayContainer *adDisplayContainer =
      [[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView
                                          viewController:self
                                          companionSlots:nil];
  // Create an ad request with our ad tag, display container, and optional user context.
  IMAAdsRequest *request = [[IMAAdsRequest alloc] initWithAdTagUrl:kTestAppAdTagUrl
                                                adDisplayContainer:adDisplayContainer
                                                   contentPlayhead:self.contentPlayhead
                                                       userContext:nil];
  
  IMASecureSignals *signals =
      [[IMASecureSignals alloc] initWithCustomData:@"My encoded signal string"];
  request.secureSignals = signals;
  
  [self.adsLoader requestAdsWithRequest:request];
}
...

Swift

BasicExample/ViewController.swift

...
private func requestAds() {
  // Create ad display container for ad rendering.
  let adDisplayContainer = IMAAdDisplayContainer(
    adContainer: videoView, viewController: self, companionSlots: nil)
  // Create an ad request with our ad tag, display container, and optional user context.
  let request = IMAAdsRequest(
    adTagUrl: ViewController.testAppAdTagURL,
    adDisplayContainer: adDisplayContainer,
    contentPlayhead: contentPlayhead,
    userContext: nil)
  
  let signals = IMASecureSignals(customData: "My encoded signal string")
  request.secureSignals = signals
  
  adsLoader.requestAds(with: request)
}
...