src/adConfiguration/fetchConfiguration.js
function fetchConfiguration(environment, applicationId, callback) {
    if(!applicationId) {
        logger.error("No application ID specified");
        return;
    }

    var deviceDetails = deviceDetector.getDeviceDetails();

    var pathname = environment.getPathname();
    var formFactor = deviceDetails.formFactor;

    var requestUrl = "";
    var queryParams = {};

    if (appSettings.overrides && appSettings.overrides.configFileLocation) {
      requestUrl = appSettings.overrides.configFileLocation;
    }else{
      requestUrl = appSettings.configurationsApiUrl;
      queryParams = {
          path: pathname,
          device: formFactor,
          "application_id":applicationId
      };
    }

    ajax.get({
        url: requestUrl,
        query: queryParams,
        success: function (data) {
            if (appSettings.overrides && appSettings.overrides.configFileLocation){
              callback(null, data.adUnits);
            }else{
              callback(null, data);
            }
        },
        error: function (err) {
            callback(err, null);
        }
    });
}
function fetchConfiguration(environment, applicationId, callback) {
    if(!applicationId) {
        logger.error("No application ID specified");
        return;
    }

    var deviceDetails = deviceDetector.getDeviceDetails();

    var pathname = environment.getPathname();
    var formFactor = deviceDetails.formFactor;

    var requestUrl = "";
    var queryParams = {};

    if (appSettings.overrides && appSettings.overrides.configFileLocation) {
      requestUrl = appSettings.overrides.configFileLocation;
    }else{
      requestUrl = appSettings.configurationsApiUrl;
      queryParams = {
          path: pathname,
          device: formFactor,
          "application_id":applicationId
      };
    }

    ajax.get({
        url: requestUrl,
        query: queryParams,
        success: function (data) {
            if (appSettings.overrides && appSettings.overrides.configFileLocation){
              callback(null, data.adUnits);
            }else{
              callback(null, data);
            }
        },
        error: function (err) {
            callback(err, null);
        }
    });
}
function fetchConfiguration ( environment , applicationId , callback ) { if ( ! applicationId ) { logger . error ( "No application ID specified" ) ; return ; } var deviceDetails = deviceDetector . getDeviceDetails ( ) ; var pathname = environment . getPathname ( ) ; var formFactor = deviceDetails . formFactor ; var requestUrl = "" ; var queryParams = { } ; if ( appSettings . overrides && appSettings . overrides . configFileLocation ) { requestUrl = appSettings . overrides . configFileLocation ; } else { requestUrl = appSettings . configurationsApiUrl ; queryParams = { path : pathname , device : formFactor , "application_id" : applicationId } ; } ajax . get ( { url : requestUrl , query : queryParams , success : function ( data ) { if ( appSettings . overrides && appSettings . overrides . configFileLocation ) { callback ( null , data . adUnits ) ; } else { callback ( null , data ) ; } } , error : function ( err ) { callback ( err , null ) ; } } ) ; }
Fetch the ad configurations to load on the current page from the server
@param environment - The environment specific implementations
@param applicationId - The applicationId to fetch ad configurations for
@param callback - The callback to execute when the configurations are retrieved
Fetch the ad configurations to load on the current page from the server