You are here

protected function AcquiaLiftReportBase::extractOverviewReportData in Acquia Lift Connector 7

Extracts the required overview data from the report data returned by Acquia Lift.

Parameters

$items: An array of items as returned from Acquia Lift.

Return value

array An associative array with information for today's and the total overview.

2 calls to AcquiaLiftReportBase::extractOverviewReportData()
AcquiaLiftABReport::generateOverviewData in plugins/agent_types/AcquiaLiftAgent.inc
Generates report overview data.
AcquiaLiftReport::loadReportData in plugins/agent_types/AcquiaLiftAgent.inc
Loads all of the data necessary to generate the reports for the agent.

File

plugins/agent_types/AcquiaLiftAgent.inc, line 1643
Provides an agent type for Acquia Lift

Class

AcquiaLiftReportBase
Base class providing report data loading functionality common to all Acquia Lift Reports.

Code

protected function extractOverviewReportData($items) {
  $agent_data = $this->agent
    ->getData();
  $decision_style = $agent_data['decision_style'] === 'adaptive' ? t('Auto-personalize') : t('A/B');
  $total_variations = isset($agent_data['decisions']) ? count($agent_data['decisions']) : 0;

  // Create an array of data for each time option.
  $report['today'] = array(
    'unformatted' => array(
      'total_lift' => $items['today']['liftOverDefaultUsingGoals'],
      'total_shown' => $items['today']['sessionCount'],
      'total_goals' => $items['today']['goalCount'],
    ),
    'test_type' => $decision_style,
    'total_shown' => $this
      ->formatReportNumber($items['today']['sessionCount']),
    'total_goals' => $this
      ->formatReportNumber($items['today']['goalCount']),
    'total_goals_positive' => $items['today']['goalCount'] > 0,
    'total_lift' => $this
      ->formatReportPercentage($items['today']['liftOverDefaultUsingGoals']),
    'total_variations' => $total_variations,
  );
  $report['all'] = array(
    'unformatted' => array(
      'total_shown' => $items['totals']['sessions']['count'],
      'total_goals' => $items['totals']['goals']['count'],
      'total_lift' => $items['today']['liftOverDefaultUsingGoalsToDate'],
    ),
    'test_type' => $decision_style,
    'total_shown' => $this
      ->formatReportNumber($items['totals']['sessions']['count']),
    'total_goals' => $this
      ->formatReportNumber($items['totals']['goals']['count']),
    'total_goals_positive' => $items['totals']['goals']['count'] > 0,
    'total_lift' => $this
      ->formatReportPercentage($items['today']['liftOverDefaultUsingGoalsToDate']),
    'total_variations' => $total_variations,
  );
  return $report;
}