You are here

function hook_dfp_global_targeting_alter in Doubleclick for Publishers (DFP) 8

Same name and namespace in other branches
  1. 7.2 dfp.api.php \hook_dfp_global_targeting_alter()
  2. 7 dfp.api.php \hook_dfp_global_targeting_alter()

Alter the global targeting key|value pairs.

Parameters

array $targeting: The global targeting key|value pairs.

1 invocation of hook_dfp_global_targeting_alter()
DfpHtmlResponseAttachmentsProcessor::getHeadBottom in src/DfpHtmlResponseAttachmentsProcessor.php
Gets the javascript to add after the slot definitions.

File

./dfp.api.php, line 32
Hooks provided by the DFP module.

Code

function hook_dfp_global_targeting_alter(&$targeting) {

  // @todo Fix example to be Drupal 8 relevant.
  // The following example adds the URL arguments array to the targeting.
  $arg = arg();
  if (!empty($arg)) {
    $targeting[] = [
      'target' => 'arg',
      'value' => $arg,
    ];
  }
}