ADK

Overview

Advisible Development Kit (ADK) is the frontend JavaScript library used to integrate Advisible ads on a website. The type definitions describing the public API of the library can be found in the ADK API reference. These definitions provide detailed information about the available interfaces and are linked throughout the documentation. Practical examples of how to use ADK can be found in the Tutorials section.

ADK implements an abstraction where behavior and content handling are separated into components with specific responsibilities. This is useful in that components can be reused and the content source can be dynamically selected without modifying application logic. Below we describe the main components of the ADK architecture.

Container

Containers attach to selected elements on the page and assume control of their behavior. What will be displayed in the element depends on the linked provider. The ContainerConfigurator provides a set of functions for configuring containers, ranging from lazy loading and stickiness to responsiveness and viewability maximization.

The ContainerApi exposes utility functions for managing the container lifecycle. React applications should use our React library, which eliminates the need for manual container lifecycle management.

Provider

Providers load content in container elements. The main purpose of the provider is to fetch content when requested and display it in the location designated by the container. The following providers are available:

IDDescriptionParameters
adk.placementImplements the API to the Placement Service. It performs ad requests and routes the results to the corresponding adapter frontend for rendering and viewability tracking. This is the default provider if not specified.PlacementProviderParams
adk.native.articleImplements the API to the True Native Ad Service for fetching, rendering and tracking direct native articles. The com.advisible.native.article adapter is responsible for rendering and tracking the content.ArticleProviderParams
adk.templateRenders a template string directly in the container.TemplateProviderParams

Adapter

Adapters in ADK provide the frontend-specific rendering and viewability tracking for content returned by the provider. ADK uses the adapter associated with each result to render it in the container. The following built-in adapters can be configured to be used by the adk.placement provider:

IDKindDescription
com.advisible.content-displayteaserRenders and tracks Content Display teasers.
com.advisible.native.teaserteaserRenders and tracks True Native teasers.
com.advisible.native.articlearticleRenders and tracks True Native articles. Also used by the adk.native.article provider.

The available options and template parameters depend on the adapter kind:

KindOptionsTemplate parameters
teaserTeaserAdapterOptionsTeaserTemplateParams
articleArticleAdapterOptionsArticleTemplateParams

Template

The template system consists of tools that load templates and produce renderable HTML dynamically using the ADK Template language. Templates can be used in two ADK configuration paths:

  1. Use adk.config.addTemplate to register a template for referencing in container configurations. This is the preferred approach for most ad rendering scenarios as it allows for fetching the ad content from a separate provider and reusing templates across different containers/adapters.
  2. Use the adk.template provider mentioned above to render a template string directly in a container. This is intended for small utility containers such as ad marking.

The parameters available for use are provided in four ways depending on how templates are used:

  1. Built-in adapters described above provide their standard parameters automatically.
  2. Provide custom parameters with the templateValues parameter available on ArticleProviderParams, ArticleAdapterOptions and TeaserAdapterOptions.
  3. When using the adk.template provider, provide parameters using the templateParams provider parameter.
  4. Provide parameters by adding an input HTML element as a descendant of the container. The data-adk-param attribute specifies the parameter name and the value attribute specifies the parameter value. ADK reads these values when containers attach and makes them available for use in the template of the container.