diff --git a/components/Dashboard.tsx b/components/Dashboard.tsx index ea7d0b8..057c267 100644 --- a/components/Dashboard.tsx +++ b/components/Dashboard.tsx @@ -473,10 +473,15 @@ const Dashboard: React.FC = ({ data, contextData, adsData = [] } yearMap.set(y, { cost: 0, attributedSales: 0, clicks: 0, impressions: 0 }); } const t = yearMap.get(y)!; - t.cost += ad.cost; - t.attributedSales += ad.attributedSales30d; - t.clicks += ad.clicks; - t.impressions += ad.impressions; + + if (t.cost === 0 && ad.cost > 0) { + console.log("DASHBOARD AD RECORD:", ad); + } + + t.cost += ad.cost || 0; + t.attributedSales += ad.attributedSales30d || ad.salesAds || 0; + t.clicks += ad.clicks || 0; + t.impressions += ad.impressions || 0; }); const result: Record = {}; diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index 575f108..78efb2a 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -455,8 +455,8 @@ export const processAdsCSV = (file: File): Promise => { const ctrRaw = getColumnValue(row, ['ctr', 'click-through rate', 'click-through-rate', 'click through rate', /click.*through.*rate/i, /ctr/i]); const acosRaw = getColumnValue(row, ['acos', 'advertising cost of sales', 'aCOS', /cost.*of.*sales/i, /acos/i]); const conversionsRaw = getColumnValue(row, ['conversions', 'konversionen', 'orders', 'pedidos', 'total orders', /order/i, /conversion/i]); - const unitsRaw = getColumnValue(row, ['units', 'einheiten', 'unidades', 'units sold', 'total units', /\d+\s*day.*unit/i, /total\s+unit/i, /units?\s*sold/i, /^units?$/i, /einheit/i, /unidad/i]); - const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /umsatz/i, /ventas/i]); + const unitsRaw = getColumnValue(row, ['units', 'einheiten', 'unidades', 'units sold', 'total units', /\d+\s*day.*unit/i, /unit.*within.*\d+\s*day/i, /total\s+unit/i, /units?\s*sold/i, /^units?$/i, /unit/i, /einheit/i, /unidad/i]); + const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /sale.*within.*\d+\s*day/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /(?