Custom AdConsent callbacks with AdEngine

Overview

When using AdEngine v3, AdConsent configuration is loaded server-side.
However, there are some cases where a custom callback is required for the configuration calls in AdConsent or other modules that may be seamlessly integrated with AdEngine using the same call structure AdConsent uses. An example is the usage of a specific Analytics module to integrate with AdConsent, other than Google Analytics. In this case, a custom callback must be provided in order to correctly handle the events to be forwarded to the analytics module.

In order to accomplish this, AdEngine provides an object, _snigelCallback, which defines custom callbacks to be used by a specific module. This object is defined at window level in the publisher's page.

_snigelCallback structure

_snigelCallback = { moduleName: { commandName: function(param) { // custom implementation }, ... }, ... }

The _snigelCallback object has a first layer that defines the module in which the callbacks are going to be used.
Inside each module, the specific callback is defined using the command name for which it was written to as the field identifier.

moduleName values

Right now, only AdConsent is supporting custom callbacks, so there is only one module name, which is "adconsent".

commandName values

The command name value can be any of the available commands in the AdConsent API reference. The callback definition shall need to follow the same AdConsent API reference for that command, regarding the number of input parameters for the callback, which data is to be expected, etc., in order to correctly set the callback for that particular command.

Examples

Setting a specific callback for the "enableGoogleAnalytics" AdConsent command

_snigelCallback = { adconsent: { enableGoogleAnalytics: function(event) { // custom implementation that uses the event parameter to forward to the analytics platform of choice } } }

Setting a specific callback for the "enableGoogleAnalytics" and "reconsiderConsent" AdConsent commands

_snigelCallback = { adconsent: { enableGoogleAnalytics: function(event) { // custom implementation that uses the event parameter to forward to the analytics platform of choice }, reconsiderConsent: function(cookieAge) { // custom implementation of what shall be done for a given cookieAge value } } }

Setting a specific callback for the "enableBannerMode" AdConsent command

Â