Adscore JavaScript and Links API

Basics of implementation

Adscore JavaScript API is the most flexible solution allowing most implementation customizations and configuration. The most basic implementation looks as follows:

<script src="//c.adsco.re" type="text/javascript"></script>
    <script type="text/javascript">
    AdscoreInit("API-ZONE-KEY", {});
    </script>

First of all, Adscore JavaScript Engine has to be loaded - that is done in the first line of code:

<script src="//c.adsco.re" type="text/javascript"></script>

While in this example it is executed synchronously, depending on your use case, it might be reasonable to load it asynchronously to improve your website performance, for example:

<script src="//c.adsco.re" type="text/javascript" onload='AdscoreInit("API-ZONE-KEY", {});'></script>

One important scenario to consider is that Adscore JavaScript Engine (https://c.adsco.re/ URL) might be blocked by some Adblock lists. In such a case, Adscore cannot work. In near future, we expect to provide users an option to use Adscore on a custom domain, which will resolve the problem. In the meantime, it might be beneficial for you to detect when our script is blocked by Adblock - this can be achieved using onerror event(in most cases), for example:

<script src="//c.adsco.re" type="text/javascript" onload='AdscoreInit("API-ZONE-KEY", {});' onerror='alert("Disable Adblock!");'></script>

Once the Adscore JavaScript Engine is loaded, it exposes exactly one function:

function AdscoreInit(apikey, options) 
Parameters:
Name Required Description
apikey yes This parameter is the Zone API Key which you can get from Zone Encryption Details in the Adscore panel. It identifies your zone for statistics, configuration and billing purposes.
options no A JavaScript objects holding key-value style configuration, for example:
{"sub_id": "1234"}