You are here

protected function AcquiaLiftReportBase::loadConversionReportHelper in Acquia Lift Connector 7

Handles all of the logic to load and extract a conversion report.

Parameters

$report_data: The array of existing report data.

$detail: True if the report should be a detailed report and false for summary.

array $options: An array of report options such as a goal for limiting.

2 calls to AcquiaLiftReportBase::loadConversionReportHelper()
AcquiaLiftReportBase::buildConversionReport in plugins/agent_types/AcquiaLiftAgent.inc
Implements AcquiaLiftReportInterface()::buildConversionReport().
AcquiaLiftReportBase::loadConversionReportData in plugins/agent_types/AcquiaLiftAgent.inc
Loads and formats the necessary reporting data in order to generate a conversion metrics graph/report.

File

plugins/agent_types/AcquiaLiftAgent.inc, line 1591
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 loadConversionReportHelper(&$report_data, $detail, $options = array()) {

  // Limit report results to the experimental group.
  $options['policies'] = 'explore';
  if ($detail) {
    $options = array_merge($options, $this
      ->getConfidenceDetailReportOptions());
  }
  $new_report = array();
  $report_name = $this
    ->getConfidenceReportRawName($options);
  if (isset($options['goal'])) {

    // Add the report name for this goal to track which goals are included.
    $report_data['goal_reports'][] = $report_name;

    // Determine the parent for reports added by this helper.
    if (!isset($report_data['conversion_goals'])) {
      $report_data['conversion_goals'][$options['goal']] = FALSE;
    }
    $detail_report =& $report_data['conversion_goals'][$options['goal']];
  }
  else {

    // Determine the parent for reports added by this helper.
    if (!isset($report_data['conversion_all'])) {
      $report_data['conversion_all'] = FALSE;
    }
    $detail_report =& $report_data['conversion_all'];
  }

  // Check if the report is already loaded.
  $subreport_name = $detail ? 'detail' : 'summary';
  if (isset($detail_report[$subreport_name])) {
    return;
  }

  // Load the raw report data.
  if (!isset($report_data['raw'][$report_name])) {
    $this
      ->loadConfidenceData($report_data, $options);
    if (isset($report_data['raw'][$report_name]['error'])) {
      return;
    }
  }
  if (!isset($report_data['raw'][$report_name]['data'])) {
    return;
  }

  // Extract the data into full report data from the raw data.
  $detail_report[$subreport_name] = $detail ? $this
    ->extractConversionReportData($report_data['raw'][$report_name]['data']['items']) : $this
    ->extractConversionSummaryData($report_data['raw'][$report_name]['data']['items']);
}