Source: NuggAd/nuggad.js

/**
 * @class
 * @classdesc Plugin to collect nugg.ad data.
 * @name NuggAd
 * @memberof ATInternet.Tracker.Plugins
 * @type {function}
 * @param parent {object} Instance of the Tag used
 * @public
 */
window['ATInternet']['Tracker']['Plugins']['NuggAd'] = function (parent) {
    "use strict";

    var self = this;
    var _confNuggAd = {};
    parent.configPlugin('NuggAd', dfltPluginCfg || {}, function (newConf) {
        _confNuggAd = newConf;
    });

    /**
     * [Object added by plugin {@link ATInternet.Tracker.Plugins.NuggAd NuggAd}] Tags to manage nugg.ad data.
     * @name nuggAd
     * @memberof ATInternet.Tracker.Tag
     * @inner
     * @type {object}
     * @property {function} set Tag helper, see details here {@link ATInternet.Tracker.Tag#nuggAd.set}
     * @public
     */
    parent['nuggAd'] = {};

    /**
     * [Helper added by plugin {@link ATInternet.Tracker.Plugins.NuggAd NuggAd}] Set nugg.ad properties.
     * @alias nuggAd.set
     * @memberof! ATInternet.Tracker.Tag#
     * @function
     * @example
     * <pre><code class="javascript">tag.nuggAd.set();
     * </code></pre>
     * @public
     */
    parent['nuggAd']['set'] = self['set'] = function() {
        parent.dispatchSubscribe('nuggAd');
        var partnerObject = window[_confNuggAd.nuggAIArray];
        if (typeof partnerObject !== 'undefined') {
            var contextPageObject = parent['getContext']('page') || {};
            var contextCustomObject = contextPageObject['customObject'] || {};
            contextCustomObject.NuggAd = partnerObject;
            contextPageObject.customObject = contextCustomObject;
            parent['setContext']('page', contextPageObject);
        }
        /* @if debug */
        parent.debug('NuggAd:nuggAd:set','DEBUG','method ended',{nuggAdData:partnerObject});
        /* @endif */
    };

    /**
     * [Helper added by plugin {@link ATInternet.Tracker.Plugins.NuggAd NuggAd}] Will be called by tracker.dispatch if any "nuggAd" has been set.
     * @alias nuggAd.onDispatch
     * @memberof! ATInternet.Tracker.Tag#
     * @function
     * @private
     */
    parent['nuggAd']['onDispatch'] = self['onDispatch'] = function() {
        /* @if debug */
        if(!parent.dispatchSubscribed('page')) {
            parent.debug('NuggAd:nuggAd:onDispatch:Error','WARNING','nugg.add data can\'t be sent without page information (use page.set())',{});
        }
        /* @endif */
    };
};
window['ATInternet']['Tracker']['addPlugin']('NuggAd');