Script-Tag Integration

This installation type is recommended if your are using no JavaScript loaders or no JavaScript at all.
It loads the FeedAd SDK into your website without the need for any loaders or module bundlers. It will expose a global feedad object which can be used to request and configure ads.

There are two ways how to load the SDK via Script-Tag:

  1. Direct reference to a specific version or the latest version of the SDK.
  2. A loader script that will load the latest and smallest version of the SDK for the user's browser.

Direct Reference

The SDK is available in 3 build variants:

  • https://web.feedad.com/sdk/feedad-sdk-lib.[version].js - ES5 build of the SDK without polyfills (UMD module).
  • https://web.feedad.com/sdk/feedad-sdk-es6.[version].js - ES6 build of the SDK without polyfills (CommonJS module).
  • https://web.feedad.com/sdk/feedad-sdk-full.[version].js - ES5 build of the SDK including polyfills (UMD module).
  • https://web.feedad.com/sdk/feedad-latest.js - Alias for the latest full version.

You will find the latest version of the SDK at https://web.feedad.com/sdk/latest.txt.

If you do not choose the full or latest variant you'll have to make sure, that the necessary polyfills are installed in your runtime: If you do not choose the full or latest variant, you'll have to make sure that the necessary polyfills are installed in your runtime:

Once you've chosen a build, just add it to your website:

<script type="text/javascript" src="https://web.feedad.com/sdk/feedad-latest.js" defer></script>
<script type="text/javascript" defer>
    // a global 'feedad' object will be available
</script>

Loader Script

When to use it

  • You do not bundle the SDK within the source code of your website.
  • You do not apply ES6 polyfills to the JavaScript runtime of your website.
  • You are integrating the FeedAd SDK into a website whose JavaScript language features you are uncertain of.

What it does

  • It checks if the browser supports the FeedAd SDK.
  • If the browser supports the SDK but is missing some JavaScript language features, it loads polyfills prior to loading the SDK.
  • It loads the most recent version of the SDK.
  • It provides a callback that is compatible with all browsers, regardless if the FeedAd SDK is supported.

How to use it

Include the loader script within your website:

<script type="text/javascript" src="https://web.feedad.com/loader/feedad-loader.js"></script>
<script type="text/javascript">
    feedad.loadSdk(function (error, feedad) {
        // the error parameter will be set if the SDK could not be loaded 
        if (error) {
            console.warn("error loading FeedAd SDK:", error);
            return;
        }

        // if the second parameter 'feedad' is set, it will provide the FeedAd SDK api.
    });
</script>

Request an Ad

Read the guide for your desired ad type to learn how to request an ad:

  1. Feed Ad - 'Banner-like' ad to integrate into one or multiple placements on your website.
  2. Standalone Ad - Pre-Roll ad to integrate before giving access to (video) content