function _build_daily_report in Acquia Lift Connector 7.2
Builds the render array for the metrics portion of the report.
Parameters
array $daily_data: The per-variation results broken down by day (shown in the graph)
array: A render array for the report.
2 calls to _build_daily_report()
- acquia_lift_report_audience in ./
acquia_lift.admin.inc - Builds the audience-specific report.
- acquia_lift_report_daily_conversions in ./
acquia_lift.admin.inc - AJAX callback to return the daily conversion report.
File
- ./
acquia_lift.admin.inc, line 2528 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function _build_daily_report($daily_data, $personalization_name, $audience_name) {
$headers = array(
t('Date'),
t('Content variation'),
array(
'data' => t('Conversion rate (%)'),
'data-conversion-metric' => 'rate',
),
array(
'data' => t('Conversion value'),
'data-conversion-metric' => 'value',
),
t('Margin of error'),
);
$build = $rows = array();
foreach ($daily_data as $choice_data) {
$rows[] = array(
'data' => array(
array(
'data' => $choice_data['timestamp'],
),
array(
'data' => $choice_data['option_label'],
'data-acquia-lift-variation-label' => _get_variation_label_abbreviated($choice_data['counter'], $choice_data['control']),
),
array(
'data' => $choice_data['conversion'],
),
array(
'data' => $choice_data['conversion_value'],
),
array(
'data' => $choice_data['margin_error'],
),
),
'no_striping' => TRUE,
);
}
if (!empty($rows)) {
$build['metric_table'] = array(
'#theme' => 'table',
'#header' => $headers,
'#rows' => $rows,
'#sticky' => FALSE,
'#attributes' => array(
'data-lift-statistics' => '',
'data-liftGraph-columnName' => '2',
'data-liftGraph-columnX' => '1',
'data-liftGraph-renderer' => 'line',
'data-liftgraph-excluded' => '5',
'data-acquia-lift-personalization' => $personalization_name,
'data-acquia-lift-audience' => $audience_name,
),
);
}
return $build;
}