Installation

The n360ortb library uses an asynchronous loader pattern that ensures the library loads without blocking page rendering while allowing you to queue commands immediately.

Async Loader Snippet

Add the following snippet to the <head> section of your page:

!function(){if(!window.n360ortb){window.n360ortb={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="https://lib.nexx360.io/nexx360_ortb.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)}function e(n,t){window.n360ortb.que.push([n,t])}}();

Formatted Version

Here's the same snippet formatted for readability:

!function() {
  if (!window.n360ortb) {
    window.n360ortb = {
      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 = "https://lib.nexx360.io/nexx360_ortb.js";

    var t = document.getElementsByTagName("script")[0];
    t.parentNode.insertBefore(n, t);
  }

  function e(n, t) {
    window.n360ortb.que.push([n, t]);
  }
}();

How It Works

The loader snippet creates a stub object on window.n360ortb that queues all API calls until the full library loads. This pattern allows you to:

  1. Call methods immediately - No need to wait for script load events

  2. Non-blocking load - The script loads asynchronously

  3. Guaranteed execution order - Commands execute in the order they were called

Script URL

The library is served from Nexx360's CDN:

circle-info

The library is automatically updated with bug fixes and improvements. No action is required on your part to receive updates.

Command Queue Pattern

You can start calling n360ortb methods immediately after including the loader snippet:

Complete HTML Example

Next Steps

Last updated

Was this helpful?