<!-- UOMO GAM / トップ・カテゴリ用 / 2026-09-15実装確認。差し替え範囲は導入手順.txtを参照。 -->
<script async src="https://link.rubiconproject.com/magnite/12970.js"></script>
<script async src="//micro.rubiconproject.com/prebid/dynamic/12970.js"></script>
<script>
    !function(a9,a,p,s,t,A,g){if(a[a9])return;function q(c,r){a[a9]._Q.push([c,r])}a[a9]={init:function(){q("i",arguments)},fetchBids:function(){q("f",arguments)},setDisplayBids:function(){},targetingKeys:function(){return[]},_Q:[]};A=p.createElement(s);A.async=!0;A.src=t;g=p.getElementsByTagName(s)[0];g.parentNode.insertBefore(A,g)}("apstag",window,document,"script","//c.amazon-adsystem.com/aax2/apstag.js");
</script>
<script async src='https://www.googletagservices.com/tag/js/gpt.js'></script>
<script>
    var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
</script>


    <script>
    var shuAd = new Object();
    shuAd.path_value = location.pathname.substr(0, 40);
    shuAd.ref_value = "null";
    if (document.referrer) {
        shuAd.ref_array = new Array();
        shuAd.ref_array = document.referrer.split("/");
        shuAd.ref_value = shuAd.ref_array[2];
    }
    googletag.cmd.push(function () {
        // 変更: ページ単位ターゲティングを Config API に移行。
        googletag.setConfig({
            targeting: {
                ref: shuAd.ref_value,
                url: shuAd.path_value,
                type: "honban"
            }
        });
    });
</script>

<script>
    const inArticleAdCount = 0;

    function is_pc() {
        return window.matchMedia('(min-width: 1160px)').matches;
    }

    googletag.cmd.push(function() {
                    if (is_pc() === true) {
                googletag.defineSlot('/16791533/UOMO/UOMO_PC_pushdown_DFP', [[1, 1], [3, 1], [728, 90], [954, 90], [970, 90], [970, 250], 'fluid'], 'UOMO_PC_pushdown_DFP').setConfig({ collapseDiv: "BEFORE_FETCH" }).addService(googletag.pubads());
            } else {
                googletag.defineSlot('/16791533/UOMO/UOMO_SP_headerbanner_DFP', [[1, 1], [2, 1], [320, 50], [320, 100], [320, 180], [300, 250], 'fluid'], 'UOMO_SP_headerbanner_DFP').addService(googletag.pubads());
            }
        
        
        
        // 変更: 既存の初回ロード停止・SRA・遅延読み込みを Config API に移行。
        googletag.setConfig({
            disableInitialLoad: true,
            singleRequest: true,
            lazyLoad: {
                fetchMarginPercent: 100,
                renderMarginPercent: 75,
                mobileScaling: 1.0
            }
        });
        googletag.enableServices();
    });
</script>

<script>
    apstag.init({
      pubID: '3905',
      adServer: 'googletag',
      bidTimeout: 2000
    });
    var apstagSlots = [];
            if (is_pc() === true) {
            apstagSlots.push({
                slotID: 'UOMO_PC_pushdown_DFP',
                sizes: [[1, 1], [3, 1], [728, 90], [954, 90], [970, 90], [970, 250], 'fluid'],
                slotName: '/16791533/UOMO/UOMO_PC_pushdown_DFP'
            })
        } else {
            apstagSlots.push({
                slotID: 'UOMO_SP_headerbanner_DFP',
                sizes: [[1, 1], [2, 1], [320, 50], [320, 100], [320, 180], [300, 250], 'fluid'],
                slotName: '/16791533/UOMO/UOMO_SP_headerbanner_DFP'
            })
        }
    
    
    </script>
<script>
    var pbjs = pbjs || {};
    pbjs.que = pbjs.que || [];

    fetchHeaderBids().then(() => {googletag.cmd.push(() => {googletag.pubads().refresh()})});

    function fetchHeaderBids() {
      const slotMap = apstagSlots.map(
        apstagSlot => {
          return {
            "name": apstagSlot.slotName,
            "divId": apstagSlot.slotID,
            "sizes": apstagSlot.sizes.filter( size => typeof size !== 'string').map( i => {return {"w":i[0], "h":i[1] }})
          }
        }
      )

      const apsPromise = new Promise( resolve => {
        apstag.fetchBids(
          {slots: apstagSlots},
          (bids) => {apstag.setDisplayBids(); return resolve()}
        )
      });

      const prebidPromise = new Promise( resolve => {
        pbjs.que.push(() => {
          pbjs.rp.requestBids({
            slotMap: slotMap,
            callback: () => {googletag.cmd.push(function() {pbjs.setTargetingForGPTAsync()}); return resolve()}
          });
        });
      });

      return Promise.race([
        Promise.all([prebidPromise, apsPromise]),
        new Promise(resolve => setTimeout(resolve, 2500))
      ])
    }
</script>
