Back to Publisher API Reference

pbjs.registerSignalSources()

To use this function, include the UserId module in your Prebid.js build.

This function will register all configured encrypted signals as described in the UserId module ESP configuration.

The condition can only be called under two conditions

  1. The pbjs.setConfig call with the user sync config must have already happend
  2. The gpt.js tag must already be loaded

Example

// initialze command queues
window.pbjs = window.pbjs || { que: []};
window.googletag = window.googletag || { cmd: []};

// wait for prebid and configure it
const prebidConfigured = new Promise(resolve => window.pbjs.que.push(resolve))
  .then(() => window.pbjs.setConfig(/* your prebid config */));

// wait for gpt.js
const gptLoaded = new Promise(resolve => window.googletag.cmd.push(resolve));

// wait for gpt and prebid to be loaded and configured
Promise.all([prebidConfigured, gptLoaded])
  .then(() => window.pbjs.registerSignalSources());

Back to Publisher API Reference