Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Doubleclick for Publishers (DFP)

757 sites Security covered Drupal 10–11
View on drupal.org

This module integrates Google Publisher Tags (GPT) into your website to display ads. It allows you to create ad tags, manage ad unit names with a hierarchical structure, and define targeting criteria for ads, either globally or on a per-tag basis.

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.

Depends on

Dependencies of the latest stable release

  • block Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Nov 2024
Latest release
7 months ago
Releases (12 mo)
2
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
3.0.0 Stable 10–11 Jan 22, 2026
2.0.3 Stable 9–10 Jan 22, 2026
3.0.0-rc1 Pre-release 10–11 Dec 29, 2024
3.0.x-dev Dev 10–11 Nov 29, 2024