Page tree

Server-side cookie sync up is mandatory while integrating with PubMatic APIs on the server side (server-to-server APIs). Since there is no access to the browser's cookies as the ad serving request is sent from the server, the below mechanism will help in obtaining the PubMatic user IDs, storing it in a server-side cookie store.

A mapping between the publisher's user ID and the PubMatic user ID should be stored in the publisher's server-side cookie store.

Let's say, is a service used by the publisher to keep a mapping of the user IDs. Let's assume that the publisher's user ID is stored on a user's browser in a cookie named "pub-user-id" with value "PUB_UserID_9890". Now if above URL is passed as then the publisher should map his user ID (PUB_UserID_9890) and PubMatic's user ID (PM_UserID_2200).

To encode such a URL as, you can use the following JavaScript code - encodeURIComponent('');


PubMatic's "user_sync.html" can call a given publisher's URL and append the PubMatic user ID to the publisher URL as mentioned below.

While sending a bid request to the PubMatic ad server, you may look up the PubMatic user ID in the cookie store and send it as a part of the request header. To do sync up-pixeling, the publisher should call the following URL in iframe on every page hit.

URL with GDPR parameters :

    &gdpr_consent=ABCFETYFDJLNBFCV&predirect=http%3A 3 D (PM_UID)


PubMatic is planning to deprecate uer_sync.html soon, therefore, it is recommended to use the userSync.js instead. For more detailed information on userSync.js, refer to userSync.js for Cookie-Sync GDPR Compliance 


  • If the client ad request does not have the user cookie for PubMatic, please send a call to the above-mentioned URL with a beacon of your domain as a value to the "predirect" parameter.
  • The above call will create a PubMatic user ID, if it does not exist already.
  • The generated PubMatic user ID will be appended to the third-party URL that was sent as "predirect" parameter's value in the above call.
  • This PubMatic user ID should be mapped to the third party user ID and then passed in the KADUSERCOOKIE parameter in the request's header to PubMatic in the next bid request.
  • For the user ID sync up with our data partners, you need to call the above URL multiple times.


Passing PubMatic user ID in request header

The PubMatic user ID should be sent in the request header as a cookie key-value pair. The user cookie key name is  KADUSERCOOKIE .

For example, Cookie:KADUSERCOOKIE=F6FC89B0-54AE-46E1-A5FF-10336B7A8E26;