6 Commits

Author SHA1 Message Date
523e04d61f Backfill Google Ads daily leads for May in MetricasDiarias
- Add get_daily_conversions_for_month() to GoogleAdsClient
- Add backfill_leads_google_mayo.py: populates 'leads' (Google conv) for all May days
- 147 day-entries updated across 49 GACampaignMes records

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 10:47:27 +02:00
45e9515ae8 Add daily metrics snapshot (MetricasDiarias) to GACampaignMes
Each optimizer run writes yesterday's cost, revenue (conversions x PPL)
and margin per campaign as a JSON entry keyed by day number into the
MetricasDiarias field. Yesterday is used because Google Ads data for
the current day is not yet available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 10:44:53 +02:00
a1aef8f58e Multiple fixes: lead matching, metrics aggregation, Log field, SPRINT with capping=0
- Fix GoogleCampaignID matching with comma delimiters (exact word boundary)
- Remove attr_utm_medium filter (campaign ID filter is specific enough)
- Fix get_campaign_metrics: accumulate all daily rows for monthly totals
- Fix SPRINT urgency: only trigger when capping > 0
- Add Log field to GACampaignMes with Airtable vs Google Ads discrepancy info
- batch_update_gacampaignmes_advice now also updates Log field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 11:05:06 +02:00
952fabe4ca Sync ConvMes and CosteMes to Airtable on each run
- Add get_monthly_metrics_all() in GoogleAdsClient: fetches
  conversions and cost for all campaigns in one query
- sync_campaigns_from_google_ads() now accepts monthly_metrics
  and updates ConvMes and CosteMes fields in Airtable
- run.py fetches monthly metrics before sync and passes them

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 21:12:05 +02:00
Claude
d68f9f5659
Sync Google Ads campaigns to Airtable before analysis
Before each run, fetch all non-removed campaigns from Google Ads
and upsert them into the Airtable campaigns table: new campaigns
are created (Activa=False, pending manual PPL/Cap/CPA setup) and
existing ones get their name updated if it changed.

https://claude.ai/code/session_01WEcdWPxGWZKk8FGwBRLGR2
2026-04-17 11:33:37 +00:00
f0d7f65c1a Initial commit 2026-04-17 12:53:25 +02:00