diff --git a/meta_ads_client.py b/meta_ads_client.py index e0243cb..7391b38 100644 --- a/meta_ads_client.py +++ b/meta_ads_client.py @@ -24,12 +24,17 @@ class MetaAdsClient: @staticmethod def _count_conversions(actions: list) -> float: - """Prioritize 'lead' to avoid double-counting with lead_grouped; include call_confirm.""" + """Prioritize 'lead' to avoid double-counting with lead_grouped; include click-to-call.""" by_type = {a["action_type"]: float(a["value"]) for a in actions} if "lead" in by_type: return by_type["lead"] if "onsite_conversion.lead_grouped" in by_type: return by_type["onsite_conversion.lead_grouped"] + # Click-to-call campaigns (Llamadas): click_to_call_call_confirm o call_confirm_grouped + if "click_to_call_call_confirm" in by_type: + return by_type["click_to_call_call_confirm"] + if "call_confirm_grouped" in by_type: + return by_type["call_confirm_grouped"] return by_type.get("call_confirm", by_type.get("contact", 0.0)) def _parse_insights_row(self, row: dict) -> dict: