fix: Ads CPC con céntimos + clics enlace Meta; gráficas barras/línea con ejes

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-29 01:28:59 +02:00
parent 5e8fd66e35
commit c83efa492d
4 changed files with 254 additions and 47 deletions

View File

@@ -18,3 +18,16 @@ export function leadFromMetaActions(
);
return primary ? nMeta(primary.value) : 0;
}
/**
* Ads Manager CPC uses «clics en el enlace» (link_click), not all clicks.
* Fall back to all clicks when link_click is absent.
*/
export function linkClicksFromMetaActions(
actions: { action_type?: string; value?: string }[] | undefined,
allClicks: number
): number {
if (!actions?.length) return allClicks;
const link = actions.find((a) => a.action_type === 'link_click');
return link ? nMeta(link.value) : allClicks;
}