NPM Installation
This installation type is recommended if you are bundling your website's JavaScript code using an NPM-like module resolution system (e.g. browserify or webpack).
The FeedAd NPM package will bundle a tiny loader within your application that loads the FeedAd SDK on runtime.
We recommend that you check out the FeedAd-Web-Examples as a reference integration.
Requirements
- A DOM context. The package will not work within a Node.JS server-side environment.
- ES6 Promises
Install the FeedAd Web SDK:
- Install the SDK loader via
npm i feedad-node
Import the SDK Loader:
Via CommonJS import:
const {loadFeedAd} = require("feedad-node");
Via ES6 import:
import {loadFeedAd} from "feedad-node";
Load the FeedAd SDK
loadFeedAd().then(feedad => { feedad.init(/* */); feedad.requestAd(/* */); });
Request an ad
Continue reading how to request an ad using the feedad
object for:
- Feed Ad - 'Banner-like' ad to integrate into one or multiple placements on your website.
- Standalone Ad - Pre-Roll ad to integrate before giving access to (video) content
Typescript
The NPM Package contains typings for the whole FeedAd SDK.
Other module loaders
The FeedAd SDK is formatted as a UMD library. Check your bundler's or module loader's documentation on how to include UMD libraries into your JavaScript code.