How to configure providers

Here we modify the image provider from the previous example so that it accepts width and height parameters. Then we use our new parameters by setting the params container option.

Parameters are sent by the container in the load and unload requests to the connected provider. An example of a common use case for parameters is when supplying a placement id to a provider that loads ads from an ad server.

adk.container.addProvider('my-provider', {
    load: ({ elem, params }) => {
        const { width, height } = params
        elem.innerHTML = `<img src="https://picsum.photos/${width}/${height}">`

    .addContainer('my-container', adk.container.config()
            width: 300,
            height: 600,