protected function AcquiaLiftReport::buildContextReport in Acquia Lift Connector 7
Returns a render array representing the context report.
Parameters
array $report_data: Reporting data for the selected dates and decision.
Return value
array A render array representing the variation set report.
1 call to AcquiaLiftReport::buildContextReport()
- AcquiaLiftReport::buildCampaignReports in plugins/
agent_types/ AcquiaLiftAgent.inc - Implements PersonalizeAgentReportInterface::buildCampaignReports().
File
- plugins/
agent_types/ AcquiaLiftAgent.inc, line 2498 - Provides an agent type for Acquia Lift
Class
- AcquiaLiftReport
- Responsible retrieving and generating reports on the Acquia Lift agent.
Code
protected function buildContextReport($report_data) {
$build = array();
if ($report_data['confidence'] === FALSE || !isset($report_data['context']['features'])) {
return array();
}
$header = array(
t('Var.'),
t('Name'),
t('Context'),
t('Shown'),
t('Goals'),
t('Conversion rate'),
t('Lift over control'),
t('Lift over random'),
);
$rows = array();
foreach ($report_data['context']['features'] as $feature_string => $feature) {
foreach ($feature as $choice) {
$lift_default_classes = array();
if (!$choice['control']) {
$lift_default_classes = $choice['lift_default_positive'] ? 'acquia-lift-report-positive' : 'acquia-lift-report-negative';
}
$row = array();
$row[] = $this
->getVariationLabel($choice['counter'] - 1, $choice['control']);
if ($choice['control']) {
$row[] = t('Control: ') . $choice['choice_id'];
}
else {
$row[] = $choice['choice_id'];
}
$row[] = array(
'data' => $choice['best'] ? $choice['feature_label'] . ' <span class="acquia-lift-best">' . t('best') . '</span>' : $choice['feature_label'],
'class' => $choice['best'] ? array(
'acquia-lift-context-best',
) : array(),
);
$row[] = $choice['decisions'];
$row[] = $choice['goals'];
$row[] = $choice['conversion'];
$row[] = array(
'data' => $choice['lift_default'],
'class' => $lift_default_classes,
);
$row[] = array(
'data' => $choice['lift_random'],
'class' => $choice['lift_random_positive'] ? array(
'acquia-lift-report-positive',
) : array(
'acquia-lift-report-negative',
),
);
$rows[] = array(
'data' => $row,
'class' => $choice['control'] ? array(
'acquia-lift-report-control',
) : array(),
'no_striping' => $choice['control'],
'data-acquia-lift-feature' => $feature_string,
);
}
}
$build['content'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#sticky' => FALSE,
);
return $build;
}