X

Display Prebid.js

Result

Original Code

Head section

<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
        <script async src="https://rawcdn.githack.com/juangseedtag/prebid-scenarios/main/prebid7.20.0.js"></script>
        <script>
            var div_1_sizes = [
                [1,1],
                [300, 250],
                [300, 600]
            ];
            var PREBID_TIMEOUT = 1000;
            var FAILSAFE_TIMEOUT = 3000;

            var adUnits = [
                {
                    code: '/4570985/st_ps_test_inArticle',
                    mediaTypes: {
                        banner: {
                            sizes: div_1_sizes
                        }
                    },
                    bids: [{
                      bidder: 'seedtag',
                      params: {
                        adUnitId: '27467176',
                        publisherId: '3699-6450-01',
                        placement: 'inArticle'
                      }
                    }]
                }
            ];

            // ======== DO NOT EDIT BELOW THIS LINE =========== //
            var googletag = googletag || {};
            googletag.cmd = googletag.cmd || [];
            googletag.cmd.push(function() {
                googletag.pubads().disableInitialLoad();
            });

            var pbjs = pbjs || {};
            pbjs.que = pbjs.que || [];

            pbjs.que.push(function() {
                pbjs.addAdUnits(adUnits);
                pbjs.requestBids({
                    bidsBackHandler: initAdserver,
                    timeout: PREBID_TIMEOUT
                });
            });

            function initAdserver() {
                if (pbjs.initAdserverSet) return;
                pbjs.initAdserverSet = true;
                googletag.cmd.push(function() {
                    pbjs.que.push(function() {
                        pbjs.setTargetingForGPTAsync();
                        googletag.pubads().refresh();
                    });
                });
            }
            // in case PBJS doesn't load
            setTimeout(function() {
                initAdserver();
            }, FAILSAFE_TIMEOUT);

            googletag.cmd.push(function() {
                googletag.defineSlot('/4570985/st_ps_test_inArticle', div_1_sizes, 'div-1').addService(googletag.pubads());
                googletag.pubads().enableSingleRequest();
                googletag.enableServices();
            });
        </script>

Body section

<h5>Result</h5>
<div id='div-1'>
   <script type='text/javascript'>
        googletag.cmd.push(function() {
        googletag.display('div-1');
     });
   </script>
</div>
juan: