API.setConfiguration(name, content)

Declares properties of the placeholder so that Confirmic knows how to configure your placeholder.

Placeholders can be configured by adding a <meta> tag to their <head>. The setConfiguration method provides a programmatic way of setting this configuration.

As part of the Placeholder's lifecycle, API.applyConfiguration() is called after API.onReady() so that any configurations you set inside API.onReady are automatically applied.

Params

NameTypeDescription
nameStringThe name of the property to configure
contentString | FunctionThe value to set the property to. If a function is passed in, it is called with the existing value of that property, or an empty string if the property is not set.
<!DOCTYPE html>
<html>

<head>
    <meta name="author" content="My Company"/>
    <meta name="title" content="My Placeholder"/>
    <script src="confirmic-api.js"></script>
</head>

<body>
    <button>
      Agree to run content
    </button>
    <script>
      API.onReady(function onReady({ params }) {
        API.setConfiguration('container-style', 'width: ' + params.width 'px');
        API.setConfiguration('container-style', function setConfig(existingStyle){
           return existingStyle + '; height: 100px'
        });
      });
    </script>
</body>

</html>

Currently supported configurations

NameTypeDescriptionValues
container-styleStringSets the style of the placeholder's container. Allowing you position and resize the placeholder as needed.Accepts any css properties delineated by semicolons. See cssText
one-clickStringSets the interaction of how a user may give consent.unset or tooltip.