Skip to content

Integration guide

Part 1: Quick Start

  1. Add the following script to your HTML:
html
<script src="https://ad.gigapub.tech/script?id=YOUR_PROJECT_ID"></script>
  1. To start showing ads, simply call the following code:
javascript
window.showGiga()
  .then(() => {
    // Your reward logic here
  })
  .catch(e => {
    // Handle errors here
  });

Optional: Fallback Logic for Safety

To ensure you don’t lose ad impressions, even if the network fails to provide a video, you can implement fallback logic:

  1. Initialize the ad display method using your specific initialization method:
javascript
const adShow = yourPreviousSdk.init();
  1. Set up a fallback mechanism:
javascript
window.AdGigaFallback = adShow;
if (window.showGiga === undefined)
    window.showGiga = () => window.AdGigaFallback();

You can ask us, and we can generate a personal code for you based on the SDK you’re using.

With this setup, if the primary ad service fails, your fallback mechanism will take over, ensuring continuity in ad displays.

Enhanced Reliability Script

If users report availability issues, you can use this enhanced script instead of the standard one. It automatically tries backup servers with a 15-second timeout:

html
<script data-project-id="YOUR_PROJECT_ID">
  !function(){
    var s=document.currentScript,p=s.getAttribute('data-project-id')||'default';
    var d=['https://ad.gigapub.tech','https://ru-ad.gigapub.tech'],i=0,t,sc;
    function l(){
      sc=document.createElement('script');
      sc.async=true;
      sc.src=d[i]+'/script?id='+p;
      clearTimeout(t);
      t=setTimeout(function(){
        sc.onload=sc.onerror=null;
        sc.src='';
        if(++i<d.length)l();
      },15000);
      sc.onload=function(){clearTimeout(t)};
      sc.onerror=function(){clearTimeout(t);if(++i<d.length)l()};
      document.head.appendChild(sc);
    }
    l();
  }();
</script>

This script automatically switches to backup servers if the primary one is unavailable, improving overall reliability.