OpenRTB Ad Server API cookie sync-up is mandatory while integrating with PubMatic APIs on the OpenRTB Ad Server. 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 OpenRTB Ad Server cookie store.
A mapping between the publisher's user ID and the PubMatic user ID should be stored in the publisher's OpenRTB Ad Server cookie store.
EXAMPLE: http://publisher.com/keepUserMap.php?pmUserId= 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 http://publisher.com/keepUserMap.php?pmUserId=PM_UserID_2200 then the publisher should map his user ID (PUB_UserID_9890) and PubMatic's user ID (PM_UserID_2200).
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.
SAMPLE URL to be used:
http: / /ads.pubmatic.com/AdServer/js/user_sync.html?p= 156578 &gdpr= 1 &gdpr_consent=ABCFETYFDJLNBFCV&predirect=http%3A
%2F%2Fpubmlisher.com%2FcookieSyncEndPoint%3Fpubmatic_uid% 3 D (PM_UID)
- Where "p" indicates the publisher's ID, "s" indicates the site ID and "predirect" indicates the third-party user ID sync-up URL to be called by PubMatic for the user sync-up. However, site ID is an optional parameter.
- Add gdpr and gdpr_consent parameters in runtime for EU traffic.
- Add PM_UID macro in the predirect URL against the parameter where the user ID needs to be replaced.
- 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 sent in the User Object by the buyeruid attribute 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 User Object by the buyeruid attribute.
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