You are here

function google_admanager_get_js in DFP Small Business (Google Ad Manager) 6

Same name and namespace in other branches
  1. 6.3 google_admanager.module \google_admanager_get_js()
  2. 6.2 google_admanager.module \google_admanager_get_js()
  3. 7.2 google_admanager.module \google_admanager_get_js()

Output the Google Admanager scripts by way of drupal_add_js().

Parameters

$scope (optional) the scope to output the javascript. see drupal_add_js().:

1 call to google_admanager_get_js()
google_admanager_preprocess_page in ./google_admanager.module
Implementation of hook_preprocess_page().

File

./google_admanager.module, line 387

Code

function google_admanager_get_js($scope = 'header') {

  //get the js for this page if it exists
  $ga_js = google_admanager_add_js();
  if (isset($ga_js)) {
    $output_order = array(
      'init',
      'service',
      'slot',
      'close',
    );
    foreach ($output_order as $type) {
      $output = '';
      foreach ($ga_js[$type] as $js) {
        $output .= $js . "\n";
      }
      drupal_add_js($output, 'inline', $scope);
    }
  }
}