fix dashboard google roas口径

This commit is contained in:
huangguancheng 2025-01-21 16:06:15 +08:00
parent a9edbe96cb
commit 19a7ccc54a

View File

@ -141,7 +141,7 @@ class AdsDashboardService
'google' => [
'google_ads' => 'spend', // 示例映射
'conversion_value' => 'platform_purchase_value',
'roas' => 'roas',
'roas' => 'google_roas',
'conversions' => 'purchases',
'ctr' => 'ctr',
'cpa' => 'google_cpa',
@ -196,6 +196,7 @@ class AdsDashboardService
// 计算指标
$roas = ($spend == 0) ? 0 : $revenue / $spend;
$google_roas = ($spend == 0) ? 0 : $purchases_value / $spend;
$ctr = ($impressions == 0) ? 0 : $clicks / $impressions;
$cpoc = ($platform_purchase == 0) ? 0 : $platform_purchase_value / $platform_purchase;
$cpa = ($purchases == 0) ? 0 : $spend / $purchases;
@ -235,6 +236,9 @@ class AdsDashboardService
case 'roas':
$value = round($roas, 2) . 'X';
break;
case 'google_roas':
$value = round($google_roas, 2) . 'X';
break;
case 'cpoc':
$value = '$' . number_format($cpoc, 2) . '%';
break;