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.29.0 or higher of the IMA SDK for Android.

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, add build dependencies, and set up their secure signals adapter in your app.

The IMA SDK for Android 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 a SecureSignals object containing your encoded custom data, as a string. Then, add the SecureSignals object to your ad request by calling adsRequest.setSecureSignals().

Here's a java example:

app/src/main/java/com/example/project name/MainActivity.java

...
private void requestAds(String adTagUrl) {
  // Create the ads request.
  AdsRequest request = sdkFactory.createAdsRequest();
  request.setAdTagUrl(adTagUrl);
  request.setContentProgressProvider(
      () -> {
        if (videoPlayer.getDuration() <= 0) {
          return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
        }
        return new VideoProgressUpdate(
            videoPlayer.getCurrentPosition(), videoPlayer.getDuration());
      });
  
  SecureSignals signal = SecureSignals.create("My encoded signal string");
  request.setSecureSignals(signal);
  
  // Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called.
  adsLoader.requestAds(request);
}
...