Google PAIR

PAIR (Publisher Advertiser Identity Reconciliation) is a framework that Google Display & Video 360 has developed to facilitate a secure and privacy-focused way for enabling advertisers and publishers to match their first-party data for marketing use cases via advanced data encryption methods without the reliance on third-party cookies.

1. Enable Google PAIR

You must contact a LiveRamp representative to get Google PAIR enabled for a desired ATS placement. Once enabled, when making a call to retrieve ATS envelopes the response may contain an identity envelope together with one or more PAIR IDs.

2. Retrieve ATS Envelopes Together with PAIR IDs


ATS API V2 Endpoint Required

To retrieve PAIR IDs, you are required to create requests using the ATS API version 2 endpoint. For example:

See our announcement to learn more.

After preparing the email or phone number identifiers, you can call the ATS envelope API as you normally would. When calling the ATS Envelope API with a PAIR-enabled placement, multiple identity envelopes can be returned; one is a regular ATS envelope and the other is a Base64-encoded string of one or multiple PAIR IDs.

An example of a response containing PAIR IDs is as follows:


3. Store the PAIR IDs

In this scenario, we are storing the PAIR ID from the below response.


To store the PAIR ID:

  1. Take the entire pairIds value object and decode from Base64 format. From the above response, the entire PAIR value object is the following:
    After decoding from Base64, it should look like:
  2. Modify the result so it contains the envelope object.
  3. Encode the entire string to Base64 format:
  4. Take the encoded string and store it in a first-party cookie or local storage called _lr_pairId.

4. Store the PAIR IDs TTL

To be GDPR and CCPA compliant, PAIR IDs are generated with a 15-day TTL ("Time to Live" / expiration time) for California (U.S.) and a 30-day TTL for all other countries and regions.

To avoid passing expired PAIR IDs that cannot be decrypted by Google APIs, we recommend you to store a timestamp next to your PAIR ID. With timestamps in place you can more easily determine if the PAIR ID needs to be refreshed when it exceeds the refresh period.

We’ve provided an example below for setting a timestamp for first-party cookies and for local storage. Based on the users geo location you will need to set the correct expiration time.

In the example below, we use the first party cookie _lr_pairId_exp and the local storage key name _lr_pairId_exp:

function calculatePairTTL(countryCode, regionCode) {
  let expirationTime = 2592000000;
  if (countryCode === 'US') {
    if (regionCode === 'CA') {
      expirationTime = 1296000000;
  expirationTime += +new Date();
  return expirationTime;

// Example: set a cookie to track envelope expiration in 15 days
document.cookie = '_lr_pairId_exp=' + calculatePairTTL('US', 'CA');

// Example: set a cookie to track envelope expiration in 30 days
document.cookie = '_lr_pairId_exp=' + calculatePairTTL();  

// Example: set localStorage to track envelope expiration for 15 days
localStorage.setItem('_lr_pairId_exp' , calculatePairTTL('US', 'CA');

// Example: set localStorage to track envelope expiration for 30 days
localStorage.setItem('_lr_pairId_exp' , calculatePairTTL());

You can then read out the appropriate timestamp like so for cookies:

// Example helper function to get cookie by name
function getCookieValue(cookieName) {
   cookieName += "=";
   var tCookieArr = document.cookie.split(';');
    for (var i = 0; i < tCookieArr.length; i++) {
     var tCookie = tCookieArr[i].trim();
     if (tCookie.indexOf(cookieName) === 0) {
       var cookieVal = tCookie.substring(cookieName.length, tCookie.length)
       return decodeURIComponent(cookieVal);
    return "";
/* Then, call the Envelope Refresh API as required */

And for local storage:

/* Then, call the Envelope Refresh API as required */

5. Refresh the PAIR IDs

We highly recommend calling the Refresh Envelope API on the first subsequent page load after a user authenticates and again every 30 minutes when a user enters a new page or refreshes the current page.

To refresh PAIR IDs you need to call the envelope refresh API using a regular ATS envelope. The ATS API response will contain new PAIR IDs that can replace the old ones.[placement id]&it=[envelope type]&iv=[envelope value]&ct=[consent type]&cv=[consent string]

To learn more, see Implement the ATS Refresh Envelope API.


When you refresh PAIR IDs, don't forget to replace the old PAIR IDs with new ones in the storage. You must also update the PAIR TTL cookie with a new timestamp.

6. Configure Your Prebid.js Implementation

If you are using Prebid to pass PAIR IDs to the bidstream, you must include the Google Pair ID Module in your Prebid configuration to make sure PAIR IDs are included in ad requests. To learn more, see Implement Prebid.js for ATS.