Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

dfp

882 sites Security covered
View on drupal.org

The DFP module integrates Google Publisher Tags (GPT) as supported by the new Doubleclick for Publishers (DFP). This module evolved from the DART module in order to support Google's major overhaul of how Ad Tags work.

Google is enforcing GPT library

Note, as of 17 Aug 2023, script was updated to use recommended CDN version of GPT library. This library will be enforced on September 18th, 2023.

-- Usage --

This blog post is very helpful in getting DFP ads setup on your site.

You can create DFP tags and display them either as a block or by using the dfp_tag($machinename); function in your code.

The new Google Publisher Tags morphed the concept of a site/zone into a 5-teired hierarchical string known as the AdUnitName. A typical ad unit name might be sports/yankees.

The new Google Publisher Tags also introduce a concept of targeting to replace the old key|value pairs used by the old DART tags. Targets have a "target" and a "value" where value can be a single string or a comma-separated list.

Global Targeting

Use the global dfp settings form to set targeting values that should be applied to all ad tags on all pages.

Tag-Specific Targeting

Each tag can include individual targeting values that will apply only to the given tag.

The DFP module introduces several tokens that can be used to create more dynamic targetng and/or AdUnitNames. These tokens include:

  • slot - the current tag's slot name (ex. topbanner)
  • network_id - the id provided by DoubleClick (usually a 4-10 digit number)
  • url_parts - this allows users to include n parts from the current URL (ex. from mysite.com/foo/bar/baz, you can include foo/bar)
  • ad_categories - this one is a bit complicated: The DFP module creates a new vocabulary called dfp_ad_categories and adds some admin settings to allow users to attach this vocab to taxonomy terms in other vocabs (thats right folks, we're tagging tags here). We do this so that taxonomy terms can be grouped separately for ad targeting purposes. For example, lets say with have vocab called "animals" => (dogs, cats, hamsters, elephants, giraffes, chickens, sheep). Now lets say that you want to target your ads to "pets", "farm animals" and "zoo animals." In this case, you can edit the terms in the "animals" vocab and assign each of them an DFP Ad Category. Basically this feature allows you to completely separate the duties of your editorial folks and your ad trafficking team. If you dont bother with this, then your terms will be added as-is. One final note: there is no longer an issue with length (or spaces) in your ad tags like there was with old DART tags so we use the full term name

For more complex implementations module developers and themers can take advantage of these hooks to customize the dfp settings on each page request:

  • hook_dfp_tag_load_alter(&$tag) - this is called immediately after a tag is loaded
  • hook_dfp_tag_alter(&$tag) - this after a tag is loaded and has been processed
  • hook_dfp_global_targeting_alter(&$targeting) - this allows other modules to add global targeting values
  • hook_dfp_short_tag_keyvals_alter(&$keyvals) - alter shorttags which are tags used by DFP when javascript is unavailable and they look like the old DART tags

If you need to enable or disable your Ad Tags on a certain day/time you can use the Exportable Scheduler module.

Branches

  • 3.0.x - Drupal 10.3+ and Drupal 11 support
  • 2.0.x - Drupal 9 and Drupal 10 support
  • 8.x - Drupal 8 and Drupal 9 support (supported until Dec 2023)
  • 7.x - Drupal 7 support (supported until Dec 2024). There are no plans to release stable 7.x-2.x

NOTE: If you are still using the older DART tags, please use the DART module instead.

Activity

Total releases
2
First release
Jan 2026
Latest release
2 months ago
Release cadence
0 days
Stability
100% stable

Releases

Version Type Release date
3.0.0 Stable Jan 22, 2026
2.0.3 Stable Jan 22, 2026