You are here

function google_admanager_gam_init in DFP Small Business (Google Ad Manager) 6.3

1 string reference to 'google_admanager_gam_init'
gam.inc in plugins/ad_providers/gam.inc

File

plugins/ad_providers/gam.inc, line 40

Code

function google_admanager_gam_init($conf) {

  //drupal_add_js can't load externaljs in 6, but it will in 7. this is

  //a workaround.
  $external_js = '//partner.googleadservices.com/gampad/google_service.js';
  google_admanager_add_js('document.write(unescape("%3Cscript src=\'' . $external_js . '\' type=\'text/javascript\'%3E%3C/script%3E"));', 'init');
  google_admanager_add_js('GS_googleAddAdSenseService("' . $conf['account'] . '");', 'service');
  google_admanager_add_js('GS_googleEnableAllServices();', 'service');

  // Add custom variables
  foreach (google_admanager_get_variables() as $key => $value) {
    google_admanager_add_js('GA_googleAddAttr("' . check_plain($key) . '", "' . check_plain($value) . '");', 'attr');
  }

  // set the close script to fetch the ads.
  google_admanager_add_js('GA_googleFetchAds();', 'close');
}