Microsoft AST Example

<!DOCTYPE html>
<html>
<head>
	<title>Test APNTAG</title>
  <!-- This is n360tag snippet, to be included in header -->
  <script>
  !function(){if(!window.n360tag){window.n360tag={init:function(){e("init",arguments)},fetchBids:function(){e("fetchBids",arguments)},setDisplayBids:function(){},targetingKeys:function(){return[]},que:[]};var n=document.createElement("script");n.async=!0,n.src="//cdn.nexx360.io/nexx360_direct_call.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)}function e(n,t){window.n360tag.que.push([n,t])}}();
  </script>


<script type="text/javascript">
   
    var apntag = apntag || {};       
    apntag.anq = apntag.anq || [];


     
    //load ast.js - async
    (function() {
       var d = document, e = d.createElement('script'), p = d.getElementsByTagName('head')[0];
       e.type = 'text/javascript';  e.async = true;
       e.src = '//acdn.adnxs.com/ast/ast.js';
       p.insertBefore(e, p.firstChild);
    })();


    apntag.anq.push(function() {
	    apntag.setPageOpts({
	        member: 6949,
          keywords: {toto: 'tata'}
	    })

      apntag.defineTag({
          invCode: "Lacentrale.desk_Annonces-HomePage_Banniere",
        sizes: [[320, 50], [728, 90], [1000, 90], [1000, 200], [1200, 90], [1200, 200], [1800, 1000], [1, 1]],
        targetId: "Banner",
        keywords: {toto: 'tata'},
      })

      apntag.defineTag({
        invCode: "Lacentrale.desk_Annonces-HomePage_Pave1", 
        sizes: [[300, 250], [300, 600]],
        targetId:  "Pave1",
      })
      console.log(apntag.getTag())
      apntag.onEvent('adLoaded', function(adObj,adError){
          console.log('adLoaded');
          console.log('[adObj]',adObj);
          console.log('[adError]',adError);
      })

      apntag.onEvent('adRequestFailure', function(adObj,adError){
          console.log('adRequestFailure');
          console.log('[adObj]',adObj);
          console.log('[adError]',adError);
      })

      apntag.onEvent('adBadRequest', function(adObj,adError){
          console.log('adBadRequest');
          console.log('[adObj]',adObj);
          console.log('[adError]',adError);
      })

      n360tag.init({
        currency: 'USD',
      });
      n360tag.fetchBids({
        slots: [
          {
            tagId: 'testnexx',
            divId: 'Banner',
            sizes: [[300, 600]]
          },
          {
            tagId: 'testnexx',
            divId: 'Pave1',
            sizes: [[300, 600]]
          }
        ],
      }, function (bids) {
        n360tag.setDisplayBids();
        apntag.loadTags();
      });
      setTimeout(() => {
        if(!n360tag.isReady){
          console.log('n360tag.IS_LOADED', n360tag.IS_LOADED)
          apntag.loadTags();
        }
      }, 1000);
    });
  </script>
    
</head>
<body>
	<h1>Test La Centrale</h1>

	<h2>Banniere</h2>
	<div id="Banner">
        <script type="text/javascript">
        apntag.anq.push(function() {
            //signal to script that this DOM element has been loaded and is ready to be populated with an ad
            apntag.showTag('Banner');
        });
        </script>
    </div>

    <h2>Pave1</h2>
	<div id="Pave1">
        <script type="text/javascript">
        apntag.anq.push(function() {
            //signal to script that this DOM element has been loaded and is ready to be populated with an ad
            apntag.showTag('Pave1');
        });
        </script>
    </div>

</body>
</html>

Creative

<script>
	var w = window;
	for (i = 0; i < 10; i++) {
		w = w.parent;
		if (w.n360tag) {
			try {
				w.n360tag.renderAd(document, "#{N360_ADID}");
				break;
			} catch (e) {
				continue;
			}
		}
	}
</script>

Last updated