Use ad exclusions to block ads

Block ads trafficked in DFP from selected inventory

Sometimes it's important to prevent certain categories of line items from running on certain parts of your content. Using labels, you can group line items and prevent them from running on the ad units that you specify.

For example, if you've got a news story about a plane crash, you probably don't want to run airline ads next to it. In these kinds of emergency situations, you can use ad exclusions to stop line items temporarily. First, set up ad exclusions by applying labels to line items and ad units. When it's time to block ads, simply activate the ad exclusions you've created.

Ad exclusions can also be applied to advertisers, which blocks all line items from the excluded advertisers. However, the blocking only applies to line items that were trafficked in DFP. If you're using dynamic allocation, the blocked advertiser's ads from Ad Exchange can still be delivered. To block an advertiser across both DFP and Ad Exchange, use unified advertiser exclusions.

Create ad exclusions

There are two parts to creating ad exclusions.

Create ad exclusion labels and apply them to line items

  1. Create an ad exclusion label. Learn more about creating labels
  2. Apply the ad exclusion label to line items. You can also apply the label to orders or advertisers; the label will be inherited by all of the line items that belong to the order or advertiser. Keep in mind that blocking an advertiser only blocks the advertiser's line items trafficked in DFP, not dynamically allocated impressions from Ad Exchange. Learn more about applying labels

Set up DFP ad exclusions for inventory

  1. On the Inventory tab, click DFP ad exclusions in the left-hand navigation panel.
  2. Click New ad exclusion.
  3. Enter a name for the ad exclusion.
  4. (Optional) Change the status to Inactive if you want to save the ad exclusion for later use.
  5. If you want to "include" ad units in the ad exclusion, click the x to the right of "Run of network" in the "Selected criteria" pane. This removes the run of network exclusion and allows you to "include" individual ad units in the exclusion instead.
  6. Select ad units and placements for the ad exclusion. Browse or search and click include for the appropriate inventory. The ad exclusion will also apply to child ad units.
  7. Choose which labels to block and allow. If you don't select Block all, line items will be blocked if they have any of the ad exclusion labels included in the Blocked labels list.

    However, if a given line item has more than one ad exclusion label, and one of the labels is included in the Allowed labels list, the line item isn't blocked, even if another of its labels is. included in the Blocked labels list.

    For example, you have a line item with the ad exclusion labels "airline" and "travel". If "airline" is in the Blocked labels list but "travel" is in the Allowed labels list, the line item won't be blocked by this ad exclusion.

    If you select Block all, all line items will be blocked except those that have an ad exclusion label that's included in the Allowed labels list.

    If you include an ad unit in a blocking rule and it contains special child ad units, those ad units will also be included in the blocking rule despite not being explicitly targeted.
  8. Click Save.

Use ad exclusions in emergency situations

If you want to use ad exclusions in emergency situations, you can set them up in advance and leave them inactive. When it's time to activate them:

  1. On the Inventory tab, click DFP ad exclusions in the left-hand navigation panel.
  2. Search for the ad exclusions you want to activate.
  3. Use the checkboxes to select one or more ad exclusions.
  4. Click Activate.

You can use the same process to deactivate ad exclusions when they're not longer needed.

You can also start ad exclusions by modifying your ad tags; this method was previously required, but is no longer recommended. Implement ad exclusions with tag modifications

You can implement ad exclusions on both Google Publisher Tags (GPT) and legacy DFP tags.


If your website uses GPT, you can set both page-level and slot-level exclusions using the GPT API.

Page-level ad exclusions

To set a page-level ad exclusion, add the following line to the <head> portion of your tag before the call to googletag.enableServices():


To set multiple category exclusions at the page level, you can either specify each exclusion on a separate line or specify them all on one line:

  • Specify on separate lines
  • Specify all on one line

Slot-level ad exclusions

You can set slot-level ad exclusions in addition to any page-level exclusions you've set. The page-level exclusions won't be overridden. To set slot-level ad exclusion, call the .setCategoryExclusion method when you define the ad slot:

googletag.defineSlot('/network_code/first_level_ad_unit/second_level_ad_unit', [width, height], 'div-gpt-ad-div_ID')

You can specify multiple category exclusions at the slot level:

googletag.defineSlot('/network_code/first_level_ad_unit/second_level_ad_unit', [width, height], 'div-gpt-ad-div_ID')

To clear slot-level ad exclusions, call the .clearCategoryExclusions method (page-level exclusions won't be cleared). This would be useful if you want to refresh the slot, for example.


Legacy DFP tags

To turn on the ad exclusion, add !c=label_name to the DFP tags where you want to block line items. You can add more than one ad exclusion label to a tag by adding multiple values to the !c= key, as in !c=label_name1,label_name2.

Tag example
<a href=";sz=widthxheight;key-values;!c=airline;ord=87654321?">

<img src=";sz=widthxheight;key-values;!c=airline;ord=87654321?" width="width" height="height" border="border">

Some publishers use content management systems to add the ad exclusion key-value dynamically to the webpages where it's needed. To return to the example of a plane crash, you could set up your content management system to insert the ad exclusion key-value into the DFP tags on any webpage that includes a set of keywords related to airlines and accidents.

GPT for video

Add excl_cat=[label] to the main video ad request URL to exclude video line items with the specified label.

Companions returned with the VAST response are part of the master ad creative set and therefore have the same exclusion labels. However, autofill companion ads are not part of the VAST response and are filled by separate requests. For autofill companions, exclusion labels need to be applied to the video request URL and companion ad slots need to have exclusions set up correctly.

Was this article helpful?