DFPUnitGenerator is a program that can generate several ad units that can be uploaded in bulk into Google DoubleClick for Publishers (DFP).
Screenshot of DFPUnitGenerator - generator of ad units for Google DoubleClick for Publishers (DFP)


In order for DFPUnitGenerator to work, you have to create (empty versions already included on the zip file) and populate the following three files:

  • sites.txt: it should contain the list of sites for which to create the individual ad units; it can be empty: the ads codes, names and descriptions will include “ROS” (ad industry acronym for ad units that are applied to all the pages);
  • sections.txt: it should contain the sections of the sites that will be targeted; it can be empty: the ads codes, names and descriptions will omit any mention of it (it is assumed to be a ROS ad);
  • adsizes.txt: it should contain the desired ad sizes; it should contain at least one ad size (the program will stop and generate no unit if there isn’t at least one size).

There is a fourth input file involved: addescription.txt: it already contains the description of the most common ad sizes, but if you want to support more you can add them in this file with the format “widthXheight[TAB space]Description” (without quote marks). If addescription.txt is empty, the ads codes, names and descriptions will include a generic “Undocumented ad size”. The units will work on Google DFP, but the codes, name and descriptions will be … ugly; therefore it is recommended that addescription.txt have the descriptions for at least the ad sizes you want to use.
Be sure to have writing permissions to the directory where the DFPUnitGenerator’s executable and the above file reside since the program need such permissions to generate the ad_units.csv file.
Once the ad_units.csv file has been created, you can upload it into Google DoubleClick for Publishers; for instructions on how to do it you can follow this guide from Google itself and click on “Bulk upload ad units in a CSV file“.


  • DFPUnitGenerator is available only in 64 bits format; while the source code is both lightweight and generic enough to be compiled in 32 bits, nowadays 64 bits operative systems are ubiquitous enough that you should not have any problem running it;
  • DFPUnitGenerator is currently only available for Linux and Windows; the source should be generic enough to be compiled for Mac, but at the moment I do not have neither a Mac for a native compilation nor the technical knowledge to do a reliable cross-compilation from either Linux or Windows;
  • At the moments DFPUnitGenerator will generate the same string for the ad codes and ad names (it is due to a personal preference; I’ll see if I can come up with something different);
  • DFPUnitGenerator supports an unlimited (see note below) number of sites in sites.txt, but only a single file for the ad sizes and only a single file for the sections; this means that the same ad sizes and sections will be applied to all sites. If the sites have totally different structures (sections) and/or require different ad sizes, you should put only one site at the time in sites.txt, modify adsizes.txt and sections.txt accordingly, generate ad_units.csv, save it somewhere else (preferably with a better identifying name), and repeat this procedure with another site in sites.txt;
  • While DFPUnitGenerator does not have any cap on the number of items in each input file, therefore making the number of ad units that can be generated virtually unlimited, it has NOT been tested with a high number of inputs. In such scenarios you may experience problems like, but not limited to, bugs, software freezes, or general system instabilities. USE AT YOUR OWN RISK!


You can download DFPUnitGenerator for your operative system from the following links:


  • [2016-09-12] Version 0.7.1: Added support for empty sites.txt, removed support for the “id” field as it is not necessary, removed header line on the csv output file, added more ad descriptions, corrected spelling errors.
  • [2016-09-05] Version 0.5.0: first public release.


If you want to provide any feedback regarding DFPUnitGenerator and the comments section is already closed, you can reach me at the addresses provided on the “Contact” section.