Fix hardcoded EUR currency — auto-detect from Google Ads account - #2
Conversation
Currency was hardcoded as EUR everywhere (€ symbols, field names). Now auto-detected via customer.currency_code GAQL query, cached per customer_id per server session, with EUR fallback on error. - New: src/adloop/ads/currency.py (get_currency_code, format_currency) - Renamed: metrics.average_cpc_eur → metrics.average_cpc_amount - Added: metrics.currency field to all enriched rows - Replaced hardcoded € in crossref.py and write.py warnings - Updated docs and rules to reflect currency-agnostic behavior - Added tests/test_currency.py (11 tests) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 4 identical inline imports with a single top-level import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey @kLOsk! Just wanted to say this is a great project! Thanks for building it - I tried it out and it works really well. As a small thank you, I'm contributing two improvements:
Both changes follow the existing safety patterns and all tests pass. Cheers! |
|
Thanks! Both great additions will review and merge asap 👍 |
…CPC-cap support Rebased on main after merging PRs #2, #3, #6. Removed duplicate draft_ad_group (kept PR #6's version with preflight checks). Adds: - update_ad_group, draft_callouts, draft_structured_snippets, draft_image_assets - Campaign expansion settings (search_partners, display_network, max_cpc) - Structured error handling for developer token and OAuth issues - Shared _apply_campaign_assets helper replacing duplicated sitelink logic All 77 tests pass.
Unfortunately not, I'm not marketing guy - Claude will be better than me for sure. |
Summary
customer.currency_codeGAQL query, cached percustomer_idper server session (one API call), with EUR fallback on errorsrc/adloop/ads/currency.pywithget_currency_code()andformat_currency()metrics.average_cpc_eur→metrics.average_cpc_amountand addedmetrics.currencyfield to all enriched rows€symbols incrossref.py(insight messages) andwrite.py(budget warnings) withformat_currency()config.yaml.example,.cursor/rules/adloop.mdc,.claude/rules/adloop.mdTest plan
tests/test_currency.pycovering:format_currencywith EUR, PLN, USD, GBP, unknown codesget_currency_codeAPI query, caching (single call), error fallback, empty rows fallback_enrich_cost_fieldswith currency parameter and absence of oldmetrics.average_cpc_eurfieldget_campaign_performanceand verifymetrics.currencymatches account currencyanalyze_campaign_conversionsand verify insight messages use correct currencydraft_campaignwith budget < 5x CPA and verify warning uses correct currency🤖 Generated with Claude Code