You are here

public function AcquiaLiftAPI::getTargetingImpactReport in Acquia Lift Connector 7

Implements AcquiaLiftReportDataSourceInterface::getTargetingImpactReport().

Overrides AcquiaLiftReportDataSourceInterface::getTargetingImpactReport

File

includes/acquia_lift.classes.inc, line 1145
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function getTargetingImpactReport($agent_name, $date_start = NULL, $date_end = NULL, $point = NULL) {
  $date_str = $this
    ->getDateString($date_start, $date_end);
  $url = $this
    ->generateEndpoint("/{$agent_name}/report/targeting-features{$date_str}");
  $headers = array(
    'Accept' => 'application/json',
  );
  if ($point !== NULL) {
    $headers['x-mpath-point'] = $point;
  }
  $response = $this
    ->httpClient()
    ->get($url, $headers);
  if ($response->code != 200) {
    $this
      ->handleBadResponse($response->code, 'Problem retrieving targeting impact report.');
    return array();
  }
  return json_decode($response->data, TRUE);
}