Page tree


Client-side cookie sync up is mandatory while integrating with PubMatic APIs on the client side (user's browser). In this case, the publisher will call the PubMatic ad server directly from browser.

As the call is initiated from the user's browser, any PubMatic cookie (KADUSERCOOKIE) stored on the user's browser will be used directly by the PubMatic ad server. To perform sync up-pixeling, the publisher should call the following URL in an iframe on every page hit.


user_sync.html

New URL  to be used:  http://ads.pubmatic.com/AdServer/js/user_sync.html?p=12345&s=23456

Where "p" indicates the publisher's ID and "s" indicates the site ID. However, site ID is an optional parameter.

Old URL (deprecated): http://ads.pubmatic.com/AdServer/js/showad.js#PIX&ptask=DSP&SPug=1


userSync.js

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 

Synchronous Tag Example


<script type="text/javascript">
        (function(){
            var script = document.createElement('script');
            script.async = true;
            script.type = 'text/javascript';
            script.src = 'https://ads.pubmatic.com/AdServer/js/userSync.js';
            script.onload = function(){
                PubMaticSync.sync({
                    pubId: 12345,
                    siteId: 23456
                });    
            }
            var node = document.getElementsByTagName('script')[0];
            node.parentNode.insertBefore(script, node);
        })();
</script>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍