Skip to main content

DFP implementation for Django

Project description

Django DFP

App that provides tags to fetch Google DFP ads.


Google provides server side adds via its DFP service. This product is inspired by the code at To keep the Django implementation as simple as possible this product changes the order of the Javascript from that page.


  1. Install or add django-dfp to your Python path.
  2. Add dfp to your INSTALLED_APPS setting.


Load dfp_tags in your template with {% load dfp_tags %}. Call { %dfp_footer %} once near the end of your document body. You would typically call it just before the closing body tag.

An example tag is

{% dfp_tag “/1234/travel” 300 250 interests=”sports,music” position=”top” color=variable foo=bar %}

String values are comma delimited. Note the lack of spaces around the comma. Both keys and values can be variables.

You may call as many tags as you want. See for more examples.


Praekelt Foundation

  • Hedley Roos



  1. Fix error in manifest.


  1. Move javascript to a template so it can be customized.


  1. Change Django to django in


  1. Republish slotRenderEnded event as DFPSlotRenderEnded.


  1. Allow targeting keys to be variables.


  1. Deprecate dfp_header.
  2. Allow arbitrary targeting keys and values to be passed to {% dfp_tag %} tag as key=value pairs.


  1. Scan for DFP div’s with javascript. In practice this means DFP ads are now cacheable.


  1. Do not use enableSingleRequest method anymore since it destroys the ability to do subsequent DFP loads via ajax.


  1. Async script loading has been re-added.
  2. Deprecate the dfp_header tag and replace with dfp_footer. DFP will now work across all browsers.


  1. Remove async script loading since it does not work.


  1. Allow variables to be passed as arguments to the template tag.


  1. First release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-dfp-0.4.1.tar.gz (7.2 kB view hashes)

Uploaded source

Built Distribution

django_dfp-0.4.1-py2.7.egg (7.5 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page