audiens/doubleclick-ddp-client

0.7.1 2020-10-07 13:22 UTC

This package is auto-updated.

Last update: 2021-04-07 14:52:09 UTC


README

Code Climate Scrutinizer Code Quality Build Status Coverage Status

An OOP implementation af the Doubleclick DDP Soap API.

Installation

To use this package, use composer:

  • from CLI: composer require Audiens/doubleclick-client
  • or, directly in your composer.json:
{
    "require": {
        "Audiens/doubleclick-client": "dev-master"
    }
}

Usage

require 'vendor/autoload.php';

$privateKey = getenv('SA_PRIVATE_KEY');
$email = getenv('SA_CLIENT_EMAIL');
$subject = getenv('SA_SUBJECT');

$reportBuilder = new ReportBuilder();
$reportService = $reportBuilder->getReportService($privateKey, $email, $subject)

// Report Fetch Example

$from = new \DateTime('-10 days');
$to = new \DateTime('now');

$reportConfig = ReportConfig(
        'your_customer_id',
        'company_name',
        'company_user_agent',
        $from,
        $to
    );

$revenueList = $reportService->getRevenue($reportConfig);

foreach ($revenueList as $revenueItem) {

   echo "BUYER NAME: " $revenueItem->getClientName(). "\n"
   echo "REVENUE ($): " $revenueItem->getSegmentRevenue(). "\n"
   echo "IMPRESSION : " $revenueItem->getSegmentImpression(). "\n"

}