Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DCM/DFA Reporting and Trafficking API PHP Samples

This is a collection of samples written in PHP which provide a starting place for your experimentation into the DCM/DFA Reporting and Trafficking API.


  • PHP 5.4+
  • JSON PHP extension
  • Composer

From the example directory, run composer install to install all dependencies.

Setup Authentication

This API uses OAuth 2.0. Learn more about Google APIs and OAuth 2.0 here:

Or, if you'd like to dive right in, follow these steps.

  • Visit to register your application.
  • From the API Manager -> Overview screen, activate access to "DCM/DFA Reporting and Trafficking API".
  • Click on "Credentials" in the left navigation menu
  • Click the button labeled "Create credentials" -> "OAuth2 client ID"
  • Select "Web Application" as the "Application type"
  • Configure javascript origins and redirect URIs
  • Click "Create client ID"
  • Click "Download JSON" and save the file as client_secrets.json in your examples directory

Security alert!

Always ensure that your client_secrets.json file is not publicly accessible. This file contains credential information which could allow unauthorized access to your DFA account.

Running the Examples

I'm assuming you've checked out the code and are reading this from a local directory. If not check out the code to a local directory.

  1. Open the sample (http://your/path/index.php) in your browser

  2. Complete the authorization steps

  3. Select an example and provide the required information

  4. Examine the response, be inspired and start hacking an amazing new app!

You can’t perform that action at this time.