adloop 0.46.0__tar.gz → 0.47.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. {adloop-0.46.0 → adloop-0.47.0}/PKG-INFO +1 -1
  2. {adloop-0.46.0 → adloop-0.47.0}/pyproject.toml +1 -1
  3. {adloop-0.46.0 → adloop-0.47.0}/pyproject.toml.orig +1 -1
  4. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/read.py +132 -8
  5. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/write.py +48 -12
  6. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/adloop.md +18 -14
  7. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/create-campaign.md +2 -2
  8. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/optimize-campaign.md +2 -2
  9. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/server.py +19 -6
  10. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/views/performance.py +7 -2
  11. {adloop-0.46.0 → adloop-0.47.0}/README.md +0 -0
  12. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/__init__.py +0 -0
  13. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/__main__.py +0 -0
  14. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/_mcp_patches.py +0 -0
  15. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/__init__.py +0 -0
  16. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/ai_max.py +0 -0
  17. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/assets.py +0 -0
  18. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/audiences.py +0 -0
  19. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/brands.py +0 -0
  20. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/campaign_settings.py +0 -0
  21. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/client.py +0 -0
  22. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/conversion_actions.py +0 -0
  23. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/currency.py +0 -0
  24. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/custom_conversion_goals.py +0 -0
  25. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/enums.py +0 -0
  26. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/forecast.py +0 -0
  27. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/gaql.py +0 -0
  28. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/image_fetch.py +0 -0
  29. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/pmax.py +0 -0
  30. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/recommendation_subscriptions.py +0 -0
  31. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/recommendations.py +0 -0
  32. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/shopping.py +0 -0
  33. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/snippet_headers.py +0 -0
  34. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ads/validate_only.py +0 -0
  35. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/auth.py +0 -0
  36. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/cli.py +0 -0
  37. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/config.py +0 -0
  38. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/conversion_setup.py +0 -0
  39. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/crossref.py +0 -0
  40. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/diagnostics.py +0 -0
  41. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/__init__.py +0 -0
  42. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/admin.py +0 -0
  43. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/annotations.py +0 -0
  44. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/attribution.py +0 -0
  45. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/audiences.py +0 -0
  46. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/audit.py +0 -0
  47. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/client.py +0 -0
  48. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/definitions.py +0 -0
  49. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/funnels.py +0 -0
  50. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/reports.py +0 -0
  51. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/retention.py +0 -0
  52. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/suggest.py +0 -0
  53. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/tracking.py +0 -0
  54. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/ga4/write.py +0 -0
  55. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gsc/__init__.py +0 -0
  56. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gsc/client.py +0 -0
  57. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gsc/reports.py +0 -0
  58. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gtm/__init__.py +0 -0
  59. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gtm/client.py +0 -0
  60. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gtm/entities.py +0 -0
  61. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gtm/read.py +0 -0
  62. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/gtm/write.py +0 -0
  63. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/merchant/__init__.py +0 -0
  64. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/merchant/client.py +0 -0
  65. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/merchant/read.py +0 -0
  66. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/__init__.py +0 -0
  67. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/auth.py +0 -0
  68. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/client.py +0 -0
  69. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/__init__.py +0 -0
  70. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/_common.py +0 -0
  71. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/ad_groups.py +0 -0
  72. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/ads.py +0 -0
  73. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/campaigns.py +0 -0
  74. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/extensions.py +0 -0
  75. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/negatives.py +0 -0
  76. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/removal.py +0 -0
  77. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/manage/targeting.py +0 -0
  78. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/read.py +0 -0
  79. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/microsoft_ads/write.py +0 -0
  80. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/oauth_redirect.py +0 -0
  81. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/pagespeed.py +0 -0
  82. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/__init__.py +0 -0
  83. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/auth.py +0 -0
  84. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/client.py +0 -0
  85. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/read.py +0 -0
  86. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/schedule.py +0 -0
  87. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/reddit/write.py +0 -0
  88. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/__init__.py +0 -0
  89. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/analyze-performance.md +0 -0
  90. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/budget-plan.md +0 -0
  91. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/create-ad.md +0 -0
  92. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules/commands/diagnose-tracking.md +0 -0
  93. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/rules_install.py +0 -0
  94. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/runtime.py +0 -0
  95. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/__init__.py +0 -0
  96. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/approval.py +0 -0
  97. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/approval_card.html +0 -0
  98. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/audit.py +0 -0
  99. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/guards.py +0 -0
  100. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/outcomes.py +0 -0
  101. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/safety/preview.py +0 -0
  102. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/tracking.py +0 -0
  103. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/upload_card.html +0 -0
  104. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/uploads.py +0 -0
  105. {adloop-0.46.0 → adloop-0.47.0}/src/adloop/views/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: adloop
3
- Version: 0.46.0
3
+ Version: 0.47.0
4
4
  Summary: Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first.
5
5
  Keywords: mcp,mcp-server,google-ads,google-ads-mcp,reddit-ads,google-analytics,ga4,claude,chatgpt,cursor,marketing
6
6
  Author: Daniel Klose
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "adloop"
3
- version = "0.46.0"
3
+ version = "0.47.0"
4
4
  description = "Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "adloop"
3
- version = "0.46.0"
3
+ version = "0.47.0"
4
4
  description = "Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -91,19 +91,44 @@ def get_campaign_performance(
91
91
  _enrich_cost_fields(rows, currency_code)
92
92
  share_error = _attach_impression_share(config, customer_id, rows, date_clause)
93
93
  budget_limited = _budget_limited_converters(rows)
94
+ target_error = _classify_budget_share(config, customer_id, budget_limited)
95
+ flag_pct = int(_BUDGET_LOST_FLAG * 100)
94
96
 
95
97
  share_insights: list[str] = []
96
- if budget_limited:
97
- names = ", ".join(
98
- f"{r['name']} ({r['search_budget_lost_impression_share_pct']}% lost to budget)"
99
- for r in budget_limited[:5]
100
- )
98
+ reliable = [r for r in budget_limited if not r.get(_BUDGET_SHARE_KEY)]
99
+ by_design = [r for r in budget_limited if r.get(_BUDGET_SHARE_KEY) == "unreliable"]
100
+ unknown = [r for r in budget_limited if r.get(_BUDGET_SHARE_KEY) == "unknown"]
101
+ if reliable:
101
102
  share_insights.append(
102
- f"{len(budget_limited)} converting campaign(s) lose at least "
103
- f"{int(_BUDGET_LOST_FLAG * 100)}% of Search impression share to "
104
- f"budget: {names}. They run out of budget while converting; "
103
+ f"{len(reliable)} converting campaign(s) lose at least "
104
+ f"{flag_pct}% of Search impression share to "
105
+ f"budget: {_budget_lost_names(reliable)}. They run out of budget while converting; "
105
106
  f"compare their CPA with the account before moving budget to them."
106
107
  )
108
+ if by_design:
109
+ share_insights.append(
110
+ f"{len(by_design)} converting campaign(s) on Maximize conversions or "
111
+ f"Maximize conversion value without a target also report at least "
112
+ f"{flag_pct}% lost to budget: {_budget_lost_names(by_design)}. Do not "
113
+ f"read that as room for more budget: without a target these "
114
+ f"strategies aim to spend the full daily budget, and Google says "
115
+ f"its Lost IS (budget) column is incompatible with them. Check "
116
+ f"Google's budget simulator before raising their budget."
117
+ )
118
+ if unknown:
119
+ why = (
120
+ f"the target lookup failed ({target_error})" if target_error
121
+ else "AdLoop could not read whether a target CPA or target ROAS is set"
122
+ )
123
+ share_insights.append(
124
+ f"{len(unknown)} converting campaign(s) on Maximize conversions or "
125
+ f"Maximize conversion value also report at least {flag_pct}% lost "
126
+ f"to budget, and {why}: {_budget_lost_names(unknown)}. Treat that "
127
+ f"share as unconfirmed: if no target is set, Google says its Lost "
128
+ f"IS (budget) column is incompatible with the strategy. Check the "
129
+ f"target and Google's budget simulator before treating them as "
130
+ f"short of budget."
131
+ )
107
132
 
108
133
  if not compact:
109
134
  result: dict = {
@@ -174,6 +199,16 @@ _IMPRESSION_SHARE_FIELDS = (
174
199
  "metrics.search_rank_lost_impression_share",
175
200
  )
176
201
  _BUDGET_LOST_FLAG = 0.2
202
+ # Without a target, Maximize conversions and Maximize conversion value aim to
203
+ # spend the whole daily budget, so they count as "limited by budget" by
204
+ # design. Google's help page says the Lost IS (budget) column is incompatible
205
+ # with them and points to the budget simulator instead:
206
+ # https://support.google.com/google-ads/answer/7381968
207
+ # With a target CPA or target ROAS set they may not spend the full budget
208
+ # (https://developers.google.com/google-ads/api/reference/rpc/v25/MaximizeConversionValue),
209
+ # and the API reports the same strategy type either way, so the target has to
210
+ # be read before the caveat applies.
211
+ _SPENDS_FULL_BUDGET_STRATEGIES = ("MAXIMIZE_CONVERSIONS", "MAXIMIZE_CONVERSION_VALUE")
177
212
  _IMPRESSION_SHARE_NOTE = (
178
213
  "Search impression share fields are fractions from the API (0.25 = 25%); "
179
214
  "the matching *_pct fields carry the same value as a percentage. Google "
@@ -233,6 +268,94 @@ def _attach_impression_share(
233
268
  return error
234
269
 
235
270
 
271
+ def _budget_lost_names(items: list[dict], limit: int = 5) -> str:
272
+ """The first few flagged campaigns with their share, and how many more."""
273
+ names = ", ".join(
274
+ f"{r['name']} ({r['search_budget_lost_impression_share_pct']}% lost to budget)"
275
+ for r in items[:limit]
276
+ )
277
+ more = len(items) - limit
278
+ return names + (f" and {more} more" if more > 0 else "")
279
+
280
+
281
+ _BUDGET_SHARE_KEY = "budget_share_reliability"
282
+ _BUDGET_SHARE_ORDER = {None: 0, "unknown": 1, "unreliable": 2}
283
+ _UNREADABLE_STRATEGY_TYPES = ("", "UNSPECIFIED", "UNKNOWN")
284
+
285
+
286
+ def _classify_budget_share(
287
+ config: AdLoopConfig, customer_id: str, flagged: list[dict]
288
+ ) -> str | None:
289
+ """Say how far the budget-lost share of each flagged campaign can be trusted.
290
+
291
+ Only Maximize conversions and Maximize conversion value need a second
292
+ look: with no target CPA and no target ROAS, Google calls the Lost IS
293
+ (budget) column incompatible with them. The target is read in one extra
294
+ query, from the campaign or from its portfolio strategy, and only when a
295
+ flagged campaign uses one of those strategy types.
296
+
297
+ Sets ``budget_share_reliability`` to "unreliable" (no target) or
298
+ "unknown" (the target could not be read) and leaves the key off every
299
+ campaign whose share reads as usual. Campaigns the column works with are
300
+ then listed first. Returns the lookup error, if there was one.
301
+ """
302
+ from adloop.ads.gaql import _parse_gaql_error, execute_query
303
+
304
+ candidates = [
305
+ r for r in flagged
306
+ if r.get("bidding_strategy_type") in _SPENDS_FULL_BUDGET_STRATEGIES
307
+ ]
308
+ if not candidates:
309
+ return None
310
+
311
+ error: str | None = None
312
+ targets: dict[str, dict] = {}
313
+ ids = ", ".join(str(r["id"]) for r in candidates if str(r.get("id") or "").isdigit())
314
+ if ids:
315
+ query = f"""
316
+ SELECT campaign.id, campaign.bidding_strategy,
317
+ campaign.maximize_conversions.target_cpa_micros,
318
+ campaign.maximize_conversion_value.target_roas,
319
+ bidding_strategy.type,
320
+ bidding_strategy.maximize_conversions.target_cpa_micros,
321
+ bidding_strategy.maximize_conversion_value.target_roas
322
+ FROM campaign
323
+ WHERE campaign.id IN ({ids})
324
+ """
325
+ try:
326
+ targets = {
327
+ str(t.get("campaign.id")): t
328
+ for t in execute_query(config, customer_id, query)
329
+ }
330
+ except Exception as exc: # noqa: BLE001 - report it, keep the report
331
+ error = _parse_gaql_error(exc)
332
+
333
+ for row in candidates:
334
+ state = _budget_share_state(targets.get(str(row.get("id"))))
335
+ if state:
336
+ row[_BUDGET_SHARE_KEY] = state
337
+ flagged.sort(key=lambda r: _BUDGET_SHARE_ORDER[r.get(_BUDGET_SHARE_KEY)])
338
+ return error
339
+
340
+
341
+ def _budget_share_state(target: dict | None) -> str | None:
342
+ """None when a target is set, "unreliable" without one, "unknown" if unread."""
343
+ if target is None:
344
+ return "unknown"
345
+ prefix = "campaign"
346
+ if target.get("campaign.bidding_strategy"):
347
+ # A portfolio strategy keeps the target on the portfolio. If the
348
+ # lookup cannot read the portfolio's type, its target is unknown.
349
+ if str(target.get("bidding_strategy.type") or "") in _UNREADABLE_STRATEGY_TYPES:
350
+ return "unknown"
351
+ prefix = "bidding_strategy"
352
+ has_target = (
353
+ (target.get(f"{prefix}.maximize_conversions.target_cpa_micros") or 0) > 0
354
+ or (target.get(f"{prefix}.maximize_conversion_value.target_roas") or 0) > 0
355
+ )
356
+ return None if has_target else "unreliable"
357
+
358
+
236
359
  def _budget_limited_converters(rows: list[dict]) -> list[dict]:
237
360
  """Converting campaigns that lose a significant share of Search to budget."""
238
361
  limited = [
@@ -249,6 +372,7 @@ def _budget_limited_converters(rows: list[dict]) -> list[dict]:
249
372
  {
250
373
  "name": r.get("campaign.name"),
251
374
  "id": r.get("campaign.id"),
375
+ "bidding_strategy_type": r.get("campaign.bidding_strategy_type"),
252
376
  "conversions": r.get("metrics.conversions"),
253
377
  "cost": r.get("metrics.cost"),
254
378
  "cpa": r.get("metrics.cpa"),
@@ -2160,8 +2160,10 @@ def draft_campaign(
2160
2160
 
2161
2161
  geo_target_ids: list of geo target constant IDs (e.g. ["2276"] for Germany,
2162
2162
  ["2840"] for USA). REQUIRED — campaigns must target specific countries.
2163
- language_ids: list of language constant IDs (e.g. ["1001"] for German,
2164
- ["1000"] for English). REQUIRED — campaigns must target specific languages.
2163
+ language_ids: optional list of language constant IDs (e.g. ["1001"] for
2164
+ German, ["1000"] for English). Google retired manual language
2165
+ targeting for Search campaigns in late September 2026, so this is no
2166
+ longer required; when given it is still sent, with a warning.
2165
2167
  location_option / negative_location_option: campaign.geo_target_type_setting.
2166
2168
  Empty leaves Google's default (PRESENCE_OR_INTEREST for both).
2167
2169
  tracking_url_template / final_url_suffix / url_custom_parameters: campaign
@@ -2452,8 +2454,6 @@ def update_campaign(
2452
2454
 
2453
2455
  if geo_target_ids is not None and len(geo_target_ids) == 0:
2454
2456
  errors.append("geo_target_ids cannot be empty — provide at least one geo target")
2455
- if language_ids is not None and len(language_ids) == 0:
2456
- errors.append("language_ids cannot be empty — provide at least one language")
2457
2457
  if geo_exclude_ids is not None:
2458
2458
  geo_exclude_ids, exclude_errors = _normalize_geo_exclude_ids(geo_exclude_ids, geo_target_ids)
2459
2459
  errors.extend(exclude_errors)
@@ -2498,6 +2498,13 @@ def update_campaign(
2498
2498
  if errors:
2499
2499
  return {"error": "Validation failed", "details": errors}
2500
2500
 
2501
+ if language_ids is not None:
2502
+ warnings.append(
2503
+ "On a Search campaign: " + _SEARCH_LANGUAGE_WARNING
2504
+ if language_ids
2505
+ else _LANGUAGE_CLEAR_WARNING
2506
+ )
2507
+
2501
2508
  if bs == "MANUAL_CPC":
2502
2509
  warnings.append(
2503
2510
  "MANUAL_CPC bidding requires constant monitoring. Consider using "
@@ -2509,7 +2516,9 @@ def update_campaign(
2509
2516
  currency_code = get_currency_code(config, customer_id)
2510
2517
  warnings.append(
2511
2518
  f"Daily budget {format_currency(daily_budget, currency_code)} is less than 5x target CPA "
2512
- f"{format_currency(target_cpa, currency_code)}. Google recommends at least 5x."
2519
+ f"{format_currency(target_cpa, currency_code)}. 5x is AdLoop's rule of thumb, not a "
2520
+ f"Google requirement; Google's low-traffic troubleshooting guide suggests a daily "
2521
+ f"budget of 2 to 3 times the target CPA."
2513
2522
  )
2514
2523
 
2515
2524
  # Surface negative geo exclusions that will survive a positive-geo
@@ -4090,6 +4099,34 @@ _VALID_BIDDING_STRATEGIES = {
4090
4099
 
4091
4100
  _VALID_CHANNEL_TYPES = {"SEARCH", "DISPLAY", "SHOPPING", "VIDEO", "PERFORMANCE_MAX"}
4092
4101
 
4102
+ # Google retired manual language targeting for Search campaigns in late
4103
+ # September 2026 (https://developers.google.com/google-ads/api/docs/deprecations,
4104
+ # https://developers.google.com/google-ads/api/docs/targeting/criteria and
4105
+ # https://support.google.com/google-ads/answer/1722078). Search ads match on
4106
+ # the language of the ads and landing page plus the user's language
4107
+ # preferences; existing language criteria read back and can be removed. The
4108
+ # documentation says adding one fails, and tells API users to stop sending
4109
+ # them. AdLoop no longer asks for language_ids and passes them through
4110
+ # unchanged when they are given, so the dry run reports Google's own answer.
4111
+ _SEARCH_LANGUAGE_WARNING = (
4112
+ "Google retired manual language targeting for Search campaigns in late "
4113
+ "September 2026: Search ads now match on the language of the ads and "
4114
+ "landing page plus the user's language preferences. Google's API "
4115
+ "documentation tells developers to stop sending language criteria for "
4116
+ "Search campaigns and says adding one fails with "
4117
+ "OPERATION_NOT_PERMITTED_FOR_CONTEXT. language_ids is passed through as "
4118
+ "given, so the dry run shows Google's answer; leave it out unless there "
4119
+ "is a reason to send it."
4120
+ )
4121
+ _LANGUAGE_CLEAR_WARNING = (
4122
+ "language_ids=[] removes all campaign-level language criteria. On a "
4123
+ "Search campaign Google no longer uses them (retired late September "
4124
+ "2026). On campaigns that still take language targeting (Display, Video, "
4125
+ "App, Demand Gen with campaign-level languages, and the YouTube, Display, "
4126
+ "Discover and Gmail channels of Performance Max) removing them can widen "
4127
+ "who sees the ads."
4128
+ )
4129
+
4093
4130
  # campaign.geo_target_type_setting. Google's default for a new campaign is
4094
4131
  # PRESENCE_OR_INTEREST, which also reaches people elsewhere who show interest
4095
4132
  # in the targeted locations.
@@ -4379,11 +4416,8 @@ def _validate_campaign(
4379
4416
  "geo_target_ids is required — campaigns must target at least one "
4380
4417
  "country/region (e.g. ['2276'] for Germany, ['2840'] for USA)"
4381
4418
  )
4382
- if not language_ids:
4383
- errors.append(
4384
- "language_ids is required — campaigns must target at least one "
4385
- "language (e.g. ['1001'] for German, ['1000'] for English)"
4386
- )
4419
+ if language_ids:
4420
+ warnings.append(_SEARCH_LANGUAGE_WARNING)
4387
4421
 
4388
4422
  bs = bidding_strategy.upper()
4389
4423
  if bs not in _VALID_BIDDING_STRATEGIES:
@@ -4474,8 +4508,10 @@ def _validate_campaign(
4474
4508
  currency_code = get_currency_code(config, customer_id)
4475
4509
  warnings.append(
4476
4510
  f"Daily budget {format_currency(daily_budget, currency_code)} is less than 5x target CPA "
4477
- f"{format_currency(target_cpa, currency_code)}. Google recommends at least 5x target CPA "
4478
- f"({format_currency(5 * target_cpa, currency_code)}/day) for sufficient learning data."
4511
+ f"{format_currency(target_cpa, currency_code)} "
4512
+ f"({format_currency(5 * target_cpa, currency_code)}/day). 5x is AdLoop's rule of thumb, "
4513
+ f"not a Google requirement; Google's low-traffic troubleshooting guide suggests a daily "
4514
+ f"budget of 2 to 3 times the target CPA."
4479
4515
  )
4480
4516
 
4481
4517
  if bs == "MANUAL_CPC":
@@ -94,7 +94,7 @@ You have access to AdLoop MCP tools that connect Google Ads, Reddit Ads and Goog
94
94
  - Ads read tools automatically compute `metrics.cost` and `metrics.cpa` from `metrics.cost_micros` — no manual division needed. `metrics.currency` contains the account's currency code (auto-detected).
95
95
  - `metrics.average_cpc_amount` is also pre-computed where available.
96
96
  - `get_ad_performance` returns full `headlines` and `descriptions` lists for RSAs, plus `ad_group_ad.policy_summary.approval_status`, `review_status` and `policy_topics` (topic names only) per ad. Ads that are `DISAPPROVED` (cannot serve) or `APPROVED_LIMITED` (serving restricted) are listed in `policy_issues` with their spend and flagged in `insights[]`; compact mode adds `by_approval_status` counts.
97
- - `get_campaign_performance` returns `metrics.search_impression_share`, `metrics.search_budget_lost_impression_share` and `metrics.search_rank_lost_impression_share` as fractions (0.25 = 25%) with matching `*_pct` percentages. Google caps the reported values: 0.0999 means below 10% share, 0.9001 means above 90% lost. They are `null` for campaigns that do not serve on Search (Display, Video, PMax, ...) or had no impressions, which means "does not apply", not zero. `budget_limited_converters` and `insights[]` flag converting campaigns losing 20% or more of impressions to budget: those can absorb more budget, rank-lost share instead points at bids, ad relevance and quality.
97
+ - `get_campaign_performance` returns `metrics.search_impression_share`, `metrics.search_budget_lost_impression_share` and `metrics.search_rank_lost_impression_share` as fractions (0.25 = 25%) with matching `*_pct` percentages. Google caps the reported values: 0.0999 means below 10% share, 0.9001 means above 90% lost. They are `null` for campaigns that do not serve on Search (Display, Video, PMax, ...) or had no impressions, which means "does not apply", not zero. `budget_limited_converters` and `insights[]` flag converting campaigns losing 20% or more of impressions to budget: those can absorb more budget, rank-lost share instead points at bids, ad relevance and quality. Exception: for a campaign on Maximize conversions or Maximize conversion value with no target CPA and no target ROAS, the budget-lost share is not a reliable signal. Without a target those strategies aim to spend the full daily budget, and Google says its Lost IS (budget) column is incompatible with them. Such campaigns carry `budget_share_reliability: "unreliable"` and get their own insight; Google's budget simulator is the place to check before raising their budget. The target is read from the campaign or from its portfolio strategy. When it cannot be read (a portfolio the account cannot read, or a failed lookup) the value is `"unknown"` and a third insight says so: treat those as unconfirmed, not as short of budget. Entries without the key are on strategies the column works with and are listed first; only those raise the dashboard's budget alert.
98
98
  - `get_change_history` returns changes newest first with counts `by_resource_type`, `by_client`, `by_user` and `by_day`. Google Ads keeps 30 days of change history, so an older start date is moved forward (see `notes`). `insights[]` flag auto-applied recommendations and budget or bidding changes. `truncated: true` means the limit was hit; narrow the range or filters to see older changes.
99
99
  - `get_recommendations` returns each recommendation's `recommendation.id` (what `draft_dismiss_recommendations` takes) and `estimated_improvement` per recommendation (potential minus base metrics) and `insights[]` that flag budget-increase recommendations, whose projected gain comes from spending more.
100
100
  - PMax tools: `get_pmax_performance` returns `insights[]` flagging weak ad strength and zero-conversion asset groups. `segments.ad_network_type` includes MIXED — a Google catch-all for most PMax traffic. Full channel splits (Search vs YouTube vs Display vs Discover) are not available via the API.
@@ -374,7 +374,7 @@ Conversions that happen offline (a sales call, a lead that turned into a deal) g
374
374
 
375
375
  | Tool | What It Does | Validation |
376
376
  |------|-------------|------------|
377
- | `draft_campaign` | Create full campaign structure (budget + campaign + ad group + keywords + geo/language targeting) | `campaign_name`, `daily_budget`, `bidding_strategy`, `geo_target_ids` (REQUIRED), `language_ids` (REQUIRED), optional `search_partners_enabled`, `display_network_enabled`, `display_expansion_enabled`, optional `max_cpc` for MANUAL_CPC ad-group bids or TARGET_SPEND CPC caps, optional `location_option` / `negative_location_option`, optional `tracking_url_template` / `final_url_suffix` / `url_custom_parameters`, optional `geo_exclude_ids` / `ad_schedule` |
377
+ | `draft_campaign` | Create full campaign structure (budget + campaign + ad group + keywords + geo/language targeting) | `campaign_name`, `daily_budget`, `bidding_strategy`, `geo_target_ids` (REQUIRED), optional `language_ids` (leave out: Google retired language targeting for Search campaigns in late September 2026), optional `search_partners_enabled`, `display_network_enabled`, `display_expansion_enabled`, optional `max_cpc` for MANUAL_CPC ad-group bids or TARGET_SPEND CPC caps, optional `location_option` / `negative_location_option`, optional `tracking_url_template` / `final_url_suffix` / `url_custom_parameters`, optional `geo_exclude_ids` / `ad_schedule` |
378
378
  | `draft_shopping_campaign` | Create a Standard Shopping campaign for a Merchant Center feed: budget + campaign (PAUSED) + product ad group + Shopping ad + one "All products" product group, atomically | `campaign_name`, `daily_budget`, `merchant_id` (must be linked to the Ads account; checked), `product_bid` (CPC of the product group, required by Google), `geo_target_ids` (REQUIRED), `bidding_strategy` MANUAL_CPC (default) / TARGET_SPEND (Maximize clicks, optional `max_cpc`) / TARGET_ROAS (+ `target_roas`), `campaign_priority` LOW/MEDIUM/HIGH, optional `feed_label`. No keywords, no languages |
379
379
  | `draft_asset_group_assets` | Add and/or remove assets of an existing PMax asset group in one atomic change: text, images, YouTube videos | `asset_group_id`, `headlines` (≤30), `long_headlines` (≤90), `descriptions` (≤90), `business_name` (≤25), `images` (`{"url"}` or `{"upload_id"}`, optional `role` marketing/logo/landscape_logo; marketing images sorted into landscape 1.91:1, square 1:1, portrait 4:5 by ratio), `youtube_video_ids`, `remove_asset_ids` |
380
380
  | `draft_asset_group_signals` | Add search themes or set the audience signal of a PMax asset group, or remove signals | `asset_group_id`, `add_search_themes` (≤80 chars, up to 50 per group), `audience_id` (one per group), `remove_signal_ids` |
@@ -457,8 +457,8 @@ Same draft → preview → `confirm_and_apply` gate; the plan carries `platform:
457
457
 
458
458
  **Safety behaviors:**
459
459
  - New campaigns and RSAs (and every Reddit campaign, ad group and ad) are created as PAUSED — user must explicitly enable them after review.
460
- - `draft_campaign` REQUIRES `geo_target_ids` and `language_ids` — campaigns without targeting waste budget. The tool rejects drafts with missing targeting.
461
- - `draft_campaign` enforces the `max_daily_budget` safety cap, rejects BROAD match + non-Smart Bidding, warns if budget is below 5x target CPA, and interprets `max_cpc` by bidding strategy: MANUAL_CPC seeds the initial ad-group bid, TARGET_SPEND sets the Maximize Clicks CPC ceiling.
460
+ - `draft_campaign` REQUIRES `geo_target_ids` — campaigns without geo targeting waste budget, and the tool rejects such drafts. `language_ids` is optional and best left out: Google retired manual language targeting for Search campaigns in late September 2026, and Search ads now match on the language of the ads and landing page plus the user's language preferences. If it is passed, the preview warns and the dry run shows whether Google still accepts it. On `update_campaign`, `language_ids=[]` removes a campaign's campaign-level language criteria.
461
+ - `draft_campaign` enforces the `max_daily_budget` safety cap, rejects BROAD match + non-Smart Bidding, warns if budget is below 5x target CPA (AdLoop's rule of thumb, not a Google requirement), and interprets `max_cpc` by bidding strategy: MANUAL_CPC seeds the initial ad-group bid, TARGET_SPEND sets the Maximize Clicks CPC ceiling.
462
462
  - `display_network_enabled` is the canonical Search display-expansion flag. `display_expansion_enabled` is only a compatibility alias and should be normalized away before presenting the plan to the user.
463
463
  - `update_ad_group` is the right tool for later MANUAL_CPC bid changes. Use `update_campaign` for TARGET_SPEND (Maximize Clicks) `max_cpc` changes.
464
464
  - Ad-group pause/enable is already handled by `pause_entity` / `enable_entity` with `entity_type="ad_group"`; do not invent a separate pause tool.
@@ -466,7 +466,7 @@ Same draft → preview → `confirm_and_apply` gate; the plan carries `platform:
466
466
  - Location options: `location_option` is who the geo targets reach — `PRESENCE` (people in or regularly in the locations), `PRESENCE_OR_INTEREST` (Google's default; also people elsewhere who show interest in them) or `SEARCH_INTEREST`. `negative_location_option` (`PRESENCE` or `PRESENCE_OR_INTEREST`) is who the exclusions exclude. Empty leaves the value as it is. The preview warns when a change widens reach: for `location_option` that is anything but `PRESENCE`, for `negative_location_option` it is `PRESENCE`, because then the exclusions only keep out people physically there, not people interested in the excluded places; `update_campaign` shows the current value as `current_location_option` / `current_negative_location_option`. Read back with `get_campaign_settings`.
467
467
  - Campaign URL options (`tracking_url_template`, `final_url_suffix`, `url_custom_parameters`): omitted leaves a value unchanged, `""` or `[]` removes it, and `url_custom_parameters` replaces the whole list. The template must contain `{lpurl}` or a variant (`{lpurl+2}`, `{unescapedlpurl}`, `{escapedlpurl+3}`, ...). Custom parameter keys are alphanumeric, at most 8 characters. The `update_campaign` preview shows each current value (`current_tracking_url_template` etc.), warns on a removal, and gives `example_click`: one of the campaign's final URLs with the campaign's options applied. It is approximate: a template on the ad group, ad or keyword overrides the campaign's, and ValueTrack parameters are filled at click time. Check it for typos before approving. Read back with `get_campaign_settings`.
468
468
  - Campaign-level broad match: `update_campaign` `keyword_match_type="BROAD"` CONVERTS every existing phrase and exact keyword in the campaign into broad match. Google shows the originals as Removed, turning the setting off does not restore them, and since September 2026 Google also upgrades such campaigns to AI Max. It is refused unless the campaign (or the `bidding_strategy` in the same call) is Smart Bidding — the same rule as BROAD keywords — checked again at apply, and needs a double confirmation. `keyword_match_type="UNSPECIFIED"` turns it off (single confirmation): no further conversions, but converted keywords stay broad and must be re-added as phrase/exact by hand. Moving a broad-match campaign to a non-Smart `bidding_strategy` is refused unless the same call passes `UNSPECIFIED`. Never turn it on to "get more traffic" on an exact/phrase campaign; read it back with `get_campaign_settings`, which lists it in `widening_settings`.
469
- - `update_campaign` replaces POSITIVE geo/language targets entirely (not append). Pass the full desired list. NEGATIVE geo exclusions (criteria with `negative=TRUE`) are **preserved** across a positive-geo replacement — they survive the swap — unless `geo_exclude_ids` is passed in the same call. The preview surfaces preserved negative geo IDs in `preserved_negative_geo_target_ids` so the change is auditable. To ADD negative geo exclusions (e.g. exclude a city inside a targeted state), use `add_negative_locations` — do not try to express exclusions through `geo_target_ids`. To remove a negative geo exclusion explicitly, use `remove_entity` with `entity_type="campaign_criterion"`, or pass `geo_exclude_ids` without it.
469
+ - `update_campaign` replaces POSITIVE geo/language targets entirely (not append). Pass the full desired list. `language_ids` is for campaign types that still take language targeting (Display, Video, App, Demand Gen with campaign-level languages, and the YouTube, Display, Discover and Gmail channels of Performance Max). For a Search campaign Google's documentation says new language criteria are no longer accepted (retired late September 2026); `language_ids=[]` removes the campaign-level ones. NEGATIVE geo exclusions (criteria with `negative=TRUE`) are **preserved** across a positive-geo replacement — they survive the swap — unless `geo_exclude_ids` is passed in the same call. The preview surfaces preserved negative geo IDs in `preserved_negative_geo_target_ids` so the change is auditable. To ADD negative geo exclusions (e.g. exclude a city inside a targeted state), use `add_negative_locations` — do not try to express exclusions through `geo_target_ids`. To remove a negative geo exclusion explicitly, use `remove_entity` with `entity_type="campaign_criterion"`, or pass `geo_exclude_ids` without it.
470
470
  - `geo_exclude_ids` and `ad_schedule` set exclusions and windows when creating a campaign, in the same atomic request. A schedule there gets a warning, not a double confirmation: the campaign is created PAUSED, and once it is enabled it serves only inside the windows. On `update_campaign` they REPLACE the whole list: omitted leaves it unchanged, `[]` clears it. Use them to set the complete state; `add_negative_locations` and `add_ad_schedule` add to what is there. The preview shows the current values (`current_geo_exclude_ids`, `current_ad_schedule`), only the entries that differ are removed or added, and apply refuses if the current values changed after the preview. `update_campaign` needs a double confirmation for a campaign's first schedule (every other hour stops serving), for clearing a schedule (the campaign serves at all hours again) and for dropping an exclusion (it can serve there again). A location can move between `geo_target_ids` and `geo_exclude_ids` in one call; a location in both lists is refused.
471
471
  - **Asset scope:** callouts and snippets link where the id points (`ad_group_id` → ad group, `campaign_id` → campaign). Account-wide (`scope="account"`) reaches every campaign without assets of its own; use it only when the user asks for account level. **Asset edits** (`update_callout`, `update_sitelink`, `update_structured_snippet`) change the asset everywhere it is linked; check with GAQL (`campaign_asset`, `ad_group_asset`, `customer_asset`) where else it is used before editing a shared asset. If the apply reports the asset changed in Google Ads since the preview, draft again.
472
472
  - **Call assets, schedules, promotions and prices.** Never guess `country_code` or `language_code`: take them from the number and the landing page, and ask when unclear. Money amounts are in the account currency (the preview names it); pass `currency_code` only for a different one. Ad schedule hours are in the **account time zone** (the previews show it), not the searcher's: convert the user's local hours first. A campaign without a schedule serves at all hours, so its first `add_ad_schedule` windows switch off every other hour and day: say so, the preview needs a double confirmation. To change a window, pass the complete list as `update_campaign` `ad_schedule`, or remove the old one with `remove_entity` (`entity_type="campaign_criterion"`, the `remove_id` from the preview) and add the new one. Prices must match the landing page or Google disapproves them.
@@ -586,12 +586,12 @@ Most websites (especially in the EU) use a GDPR cookie consent banner. This has
586
586
  3. **Pre-write checks (CRITICAL):**
587
587
  - **Bidding strategy**: Default to MAXIMIZE_CONVERSIONS. It tells Google the goal is conversions (not just clicks), doesn't waste budget on non-converting clicks, and starts building the conversion model from day one — even with zero history, Google uses broad signals (search intent, device, time of day). Only use TARGET_SPEND/MANUAL_CPC if the user explicitly requests it and understands the trade-offs.
588
588
  - **Geo targeting**: ALWAYS ask the user which countries/regions to target if not specified. Never create a campaign without geo targets — untargeted campaigns waste budget on irrelevant geographies. Common IDs: 2276=Germany, 2040=Austria, 2756=Switzerland, 2840=USA, 2826=UK.
589
- - **Language targeting**: ALWAYS ask the user which languages to target if not specified. Language targeting restricts ads to users whose browser/Google language matches — without it, ads show to anyone in the geo region regardless of language. Common IDs: 1001=German, 1000=English, 1002=French.
589
+ - **Language**: do not ask for language targets for a Search campaign. Google retired manual language targeting there in late September 2026; Search ads match on the language of the ads and landing page plus the user's language preferences. Confirm which language the ads and landing page are in instead.
590
590
  - Does the account have conversion tracking working? Call `attribution_check` — if zero conversions across the board, WARN that new campaigns won't help until tracking is fixed.
591
- - Is the proposed budget reasonable? Must be ≤ `max_daily_budget` in config, and ideally ≥ 5x target CPA.
592
- 4. Call `draft_campaign` with campaign name, daily budget, bidding strategy, `geo_target_ids`, `language_ids`, ad group name, and optional keywords
591
+ - Is the proposed budget reasonable? Must be ≤ `max_daily_budget` in config, and ideally ≥ 5x target CPA (AdLoop's rule of thumb, not a Google requirement; Google's low-traffic troubleshooting guide suggests 2 to 3 times the target CPA).
592
+ 4. Call `draft_campaign` with campaign name, daily budget, bidding strategy, `geo_target_ids`, ad group name, and optional keywords
593
593
  5. Review the preview and any `warnings` (budget sufficiency, MANUAL_CPC warning, BROAD match rejection)
594
- 6. Present the complete preview to the user — emphasize the campaign will be created as PAUSED, and confirm the geo/language targets are correct
594
+ 6. Present the complete preview to the user — emphasize the campaign will be created as PAUSED, and confirm the geo targets are correct
595
595
  7. After campaign creation, remind the user to:
596
596
  - Add ads via `draft_responsive_search_ad` (with display paths set)
597
597
  - Add sitelinks via `draft_sitelinks` (at least 4 recommended)
@@ -630,8 +630,8 @@ Most websites (especially in the EU) use a GDPR cookie consent banner. This has
630
630
  3. **Pre-write checks:**
631
631
  - If changing to MAXIMIZE_CONVERSIONS: good default choice — confirm with the user
632
632
  - If changing to MANUAL_CPC: warn about the trade-offs (no automation, requires constant monitoring)
633
- - If removing geo or language targets: warn that this broadens targeting and may waste budget
634
- - If the campaign is in a learning phase: warn that changes will restart the learning phase
633
+ - If removing geo targets: warn that this broadens targeting and may waste budget. Language criteria on a Search campaign are no longer used by Google (retired late September 2026), so removing them there changes nothing; on campaign types that still take language targeting they narrow who sees the ads, so removing them can widen it
634
+ - Say whether the change shows Google's "Learning" status (up to 7 days, ads keep serving): a new or reactivated bid strategy, campaigns added to or removed from a portfolio strategy, or a significant change of conversion goals does. Budget, target, creative and targeting changes do not (budget, target and targeting changes apply from the next auction; new or edited ads go through policy review before they serve)
635
635
  - **Shared budgets and portfolio strategies:** a budget change on a SHARED budget changes the daily budget of every campaign using it, and a bidding change on a campaign in a portfolio bid strategy takes it out of the portfolio. The preview names the other campaigns and asks for a double confirmation; tell the user plainly before they confirm. If they meant only this campaign, its own budget has to be set up in Google Ads first
636
636
  4. Call `update_campaign` with only the parameters that need to change
637
637
  5. Present the preview — clearly show what's changing (old → new)
@@ -1003,6 +1003,10 @@ For cities/regions, use `run_gaql` with `geo_target_constant` resource or look u
1003
1003
 
1004
1004
  ### Common Language IDs (languageConstants)
1005
1005
 
1006
+ For the Keyword Planner tools (`discover_keywords`, `estimate_budget`) and for
1007
+ campaigns that still take language targeting. Search campaigns do not (see
1008
+ Marketing Best Practices).
1009
+
1006
1010
  Verified against the `language_constant` resource. Google accepts a wrong
1007
1011
  language ID silently, so confirm anything not listed here with:
1008
1012
  `SELECT language_constant.id, language_constant.code, language_constant.name FROM language_constant`
@@ -1033,11 +1037,11 @@ When advising on Google Ads:
1033
1037
 
1034
1038
  - **Bid strategy default**: Prefer MAXIMIZE_CONVERSIONS for new campaigns. It leverages Google's signals from day one, even without conversion history. TARGET_SPEND (Maximize Clicks) only makes sense as a deliberate data-collection phase — and even then, MAXIMIZE_CONVERSIONS is usually better because it starts optimizing for conversions immediately instead of just accumulating clicks.
1035
1039
  - **Geo targeting is mandatory**: Every campaign must target specific countries/regions. Untargeted campaigns serve globally and waste budget. ALWAYS set geo_target_ids when creating campaigns.
1036
- - **Language targeting is mandatory**: Every campaign must target specific languages. Without it, ads show to all users in the geo region regardless of browser language. A German-language ad shown to an English speaker in Germany wastes budget. ALWAYS set language_ids when creating campaigns.
1040
+ - **Search campaigns take no language targeting**: Google retired manual language targeting for Search campaigns in late September 2026. Search ads match on the language of the ads and landing page plus the user's language preferences, so write both in the language you want to reach. Language targeting still applies to Display, Video, App and Demand Gen campaigns, and within Performance Max to YouTube, Display, Discover and Gmail (not to its Search or Shopping ads).
1037
1041
  - **Match types**: Never recommend Broad Match without Smart Bidding (tCPA or tROAS) active on the campaign. Broad Match without Smart Bidding leads to budget waste.
1038
1042
  - **CPA monitoring**: Flag any campaign where CPA exceeds 3x the target for review.
1039
- - **Budget sufficiency**: A campaign's daily budget should be at least 5x its target CPA to generate enough data for the algorithm.
1040
- - **Learning phase**: Don't edit campaigns that are in an active learning phase (Google Ads shows "Learning" or "Learning (limited)" status). Wait until the learning phase completes before making changes.
1043
+ - **Budget sufficiency**: AdLoop's rule of thumb is a daily budget of at least 5x the target CPA, so a campaign can collect several conversions a day. It is not a Google requirement: Google's low-traffic troubleshooting guide suggests at least 2 to 3 times the target CPA, or 10 times the expected CPC. Treat a smaller budget as a prompt to check, not as an error.
1044
+ - **Learning status**: Google shows "Learning" for up to 7 days after a bid strategy is created or reactivated, after campaigns, ad groups or keywords are added to or removed from it, or after the conversion goals change significantly. Ads keep serving meanwhile. Changes to budgets, targets, creatives and targeting never trigger it. Budget, target and targeting changes apply from the next auction; new or edited ads have to pass policy review before they serve. Unless the business needs it, avoid several target changes within one conversion cycle: Google's guidance is to give a new target 1 to 2 conversion cycles.
1041
1045
  - **Negative keyword hygiene**: After reviewing search terms, always suggest adding irrelevant terms as negatives. Group them by theme.
1042
1046
  - **RSA best practices**: Provide at least 8-10 unique headlines (out of max 15) and 3-4 descriptions (out of max 4). Make headlines diverse — don't repeat the same message. **Pin only when necessary** — pinning reduces Google's ability to rotate assets and typically lowers ad strength. Reach for the dict shape `{"text": "...", "pinned_field": "HEADLINE_1"}` only for concrete brand-safety/compliance reasons. For phone numbers, prefer a campaign-level call asset over a pinned headline. See "Ad Copy Character Limits" section below for language-specific guidance.
1043
1047
  - **Quality Score**: If keywords have quality score < 5, prioritize improving ad relevance and landing page experience over bid increases.
@@ -13,14 +13,14 @@ Create a new Google Ads campaign for: $ARGUMENTS
13
13
  ## 2. Budget estimation
14
14
 
15
15
  - If user hasn't specified a budget, call `estimate_budget` with proposed keywords
16
- - Ask for target geography and language if not clear (common: 2276=Germany, 2840=USA, 2826=UK)
16
+ - Ask for target geography if not clear (common: 2276=Germany, 2840=USA, 2826=UK). Search campaigns take no language targeting (Google retired it in late September 2026): confirm which language the ads and landing page are in instead
17
17
  - Present the forecast: estimated clicks, impressions, cost, avg CPC
18
18
 
19
19
  ## 3. Pre-write checks (CRITICAL)
20
20
 
21
21
  - Bidding strategy: recommend MAXIMIZE_CONVERSIONS or TARGET_CPA over MANUAL_CPC
22
22
  - Conversion tracking: run `attribution_check` — if zero conversions across the board, WARN that a new campaign won't help until tracking is fixed
23
- - Budget: must be <= max_daily_budget in config, ideally >= 5x target CPA
23
+ - Budget: must be <= max_daily_budget in config, ideally >= 5x target CPA (AdLoop's rule of thumb, not a Google requirement; Google's own guideline is 2 to 3 times)
24
24
  - Keywords: if using BROAD match, campaign MUST use Smart Bidding — otherwise use PHRASE or EXACT
25
25
 
26
26
  ## 4. Draft campaign
@@ -43,12 +43,12 @@ Follow this checklist in order — earlier items have higher impact.
43
43
 
44
44
  ## 6. Budget
45
45
 
46
- - Is daily budget >= 5x target CPA?
46
+ - Is daily budget >= 5x target CPA? (AdLoop's rule of thumb, not a Google requirement; Google's low-traffic guide suggests 2 to 3 times)
47
47
  - If not: either increase budget or focus on reducing CPA first
48
48
  - Use `estimate_budget` if considering budget changes
49
49
 
50
50
  ## Rules
51
51
 
52
52
  - One change at a time — show preview, wait for approval
53
- - Never edit during Learning Phase
53
+ - Google's "Learning" status (up to 7 days) follows a new or reactivated bid strategy, a change in what the strategy covers, or a significant conversion-goal change. Budget, target, creative and targeting changes never trigger it. Avoid several target changes within one conversion cycle
54
54
  - Priority order: tracking > negatives > QS > ad copy > bidding > budget
@@ -183,8 +183,10 @@ def _build_orchestration_instructions() -> str:
183
183
  "`attribution_check` — they factor this in.\n"
184
184
  "- `cost_micros / 1,000,000` = actual currency. Read tools "
185
185
  "auto-compute `metrics.cost`; only `run_gaql` returns raw micros.\n"
186
- "- New campaigns MUST have `geo_target_ids` and `language_ids` set. "
187
- "Untargeted campaigns waste budget."
186
+ "- New campaigns MUST have `geo_target_ids` set. Untargeted campaigns "
187
+ "waste budget. Search campaigns take no language targeting any more "
188
+ "(Google retired it in late September 2026): write the ads and landing "
189
+ "page in the language you want to reach."
188
190
  )
189
191
 
190
192
 
@@ -220,9 +222,12 @@ mcp = FastMCP(
220
222
 
221
223
 
222
224
 
225
+ # "core": ADLOOP_TOOLSETS enables components by tag (only=True), and an
226
+ # untagged resource would be switched off while tools still point at it.
223
227
  @mcp.resource(
224
228
  CARD_URI,
225
229
  name="approval_card",
230
+ tags={"core"},
226
231
  title="AdLoop approval card",
227
232
  description="Renders a change preview with Test run and Apply buttons.",
228
233
  mime_type=CARD_MIME_TYPE,
@@ -235,6 +240,7 @@ def approval_card() -> str:
235
240
  @mcp.resource(
236
241
  UPLOAD_CARD_URI,
237
242
  name="upload_card",
243
+ tags={"core"},
238
244
  title="AdLoop image upload",
239
245
  description="A drop zone that uploads images to AdLoop for use as ad assets.",
240
246
  mime_type=CARD_MIME_TYPE,
@@ -249,6 +255,7 @@ def upload_card() -> str:
249
255
  @mcp.resource(
250
256
  VIEW_URI,
251
257
  name="adloop_view",
258
+ tags={"core"},
252
259
  title="AdLoop view",
253
260
  description="Draws a read result as a dashboard (charts and tables).",
254
261
  mime_type=VIEW_MIME_TYPE,
@@ -3894,7 +3901,7 @@ def draft_campaign(
3894
3901
  daily_budget: float,
3895
3902
  bidding_strategy: str,
3896
3903
  geo_target_ids: _StrList,
3897
- language_ids: _StrList,
3904
+ language_ids: _StrListOpt = None,
3898
3905
  customer_id: str = "",
3899
3906
  target_cpa: float = 0,
3900
3907
  target_roas: float = 0,
@@ -3939,7 +3946,10 @@ def draft_campaign(
3939
3946
  geo_target_ids: REQUIRED list of geo target constant IDs.
3940
3947
  Common: "2276" Germany, "2040" Austria, "2756" Switzerland, "2840" USA,
3941
3948
  "2826" UK, "2250" France. Full list: Google Ads API geo target constants.
3942
- language_ids: REQUIRED list of language constant IDs.
3949
+ language_ids: Optional list of language constant IDs. Google retired
3950
+ manual language targeting for Search campaigns in late September
3951
+ 2026 (ads match on the language of the ads and landing page), so
3952
+ leave it out; when given it is still sent and the preview warns.
3943
3953
  Common: "1001" German, "1000" English, "1002" French, "1003" Spanish,
3944
3954
  "1004" Italian, "1014" Portuguese. Full list: Google Ads API
3945
3955
  language constants.
@@ -4122,8 +4132,11 @@ def update_campaign(
4122
4132
  geo_target_ids: REPLACES all positive geo targets; must not be empty
4123
4133
  when given. Common IDs: "2276" Germany, "2040" Austria, "2756"
4124
4134
  Switzerland, "2840" USA, "2826" UK.
4125
- language_ids: REPLACES all language targets; must not be empty when
4126
- given. Common IDs: "1001" German, "1000" English, "1002" French,
4135
+ language_ids: REPLACES all campaign-level language targets; []
4136
+ removes them. Not for Search campaigns: Google retired manual
4137
+ language targeting there in late September 2026 and documents
4138
+ that existing criteria can only be removed; the preview warns.
4139
+ Common IDs: "1001" German, "1000" English, "1002" French,
4127
4140
  "1003" Spanish, "1004" Italian.
4128
4141
  search_partners_enabled: Include ads on Search partners. Omitted leaves
4129
4142
  the setting unchanged.
@@ -186,8 +186,13 @@ def _alerts(rows: list[dict], result: dict) -> dict:
186
186
  idle = [i for i in result.get("zero_conversion_spenders") or [] if isinstance(i, dict)]
187
187
  else:
188
188
  idle = [{"name": r["name"], "cost": r["cost"]} for r in rows if r["cost"] > 0 and not r["conversions"]]
189
- limited = [i for i in result.get("budget_limited_converters") or [] if isinstance(i, dict)]
190
- if not limited:
189
+ flagged = [i for i in result.get("budget_limited_converters") or [] if isinstance(i, dict)]
190
+ # Google calls the budget-lost share incompatible with Maximize conversions
191
+ # and Maximize conversion value run without a target, so those campaigns
192
+ # are not presented as held back by budget.
193
+ # A campaign whose target could not be read is left out as well.
194
+ limited = [i for i in flagged if not i.get("budget_share_reliability")]
195
+ if not flagged:
191
196
  limited = [
192
197
  {"name": r["name"], "search_budget_lost_impression_share_pct": round(r["lost_to_budget"] * 100)}
193
198
  for r in rows
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes