Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(marketing-analytics): add step-by-step instructions to recommendations (#127709)

Javier Bahamondesa2927dfa1ef2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 38592780587f..3c8b2d5e8e53 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -13687,13 +13687,17 @@ snapshots:
scenes-app-marketing-analytics-recommendations--missing-tables--light:
hash: v1.k794b7964.caf7a21c4c18fdae6c949d9221b7bb849467836773b52d0afc0f3bc03cb21a1c.934bgxS4q3xLz9ut7UZPOl-pcuyT9cwFSm75XVwLAaU
scenes-app-marketing-analytics-recommendations--missing-tables-in-modal--dark:
- hash: v1.k794b7964.6f1b534875c960cd10431d6e4fb378b06ea600a197b73affe46a30c147e56af5.1ndbogVcT2vWlWyHJlTEFkkYvtsGtji19zF45SdV4Dg
+ hash: v1.k794b7964.b6b0fd695398c90a92d399b449c84f0c14fd2389bdec339c408cff7dc269184a.p8T2G9qRfwkCHRmYsZGO7KvD776RSk64AW2hlzIwokQ
scenes-app-marketing-analytics-recommendations--missing-tables-in-modal--light:
- hash: v1.k794b7964.7c74367fc4eeacc1f525352bcbb0accdfec06e6c2bc13b9dc2d978a26d2c69fd.v0rqI3hSg8KgI7c8M73aoxW7GLcYND2t2ayv-3ZaA6Y
+ hash: v1.k794b7964.fa9f7cb18bdeec3decf5dc1e7c3faf0afddd5b6248f816d69e38d71d92a9082d.bZfgXNPPX4zFLQGGVVvYMskOAvBNgDos57Jhs03oBKY
scenes-app-marketing-analytics-recommendations--modal--dark:
hash: v1.k794b7964.912485b9ea2606940db74c824e0e19607c42b51099ee2f4a28e0550ed49fd972.iT4FxMcmuLx7AAhxnwWlgIUL-oq_r6S0UiW8UhzpRFM
scenes-app-marketing-analytics-recommendations--modal--light:
hash: v1.k794b7964.c04f2966e2cc693edb8a6594142f2b32664619e532b659bb01ceec6a6c71e8a0.10rYCjA5Qfk5wA1lJ_--JIPJDDSGuq-cbUo4OeCGts8
+ scenes-app-marketing-analytics-recommendations--modal-instructions--dark:
+ hash: v1.k794b7964.0dd609452aacdef0b6a6a95bf1507258a3006b05f25e653d62f59a8e35e51ecf.wIid_-9Jwl37jSjw9rAOA8WlALo5_r0mxBOfkd4RO-w
+ scenes-app-marketing-analytics-recommendations--modal-instructions--light:
+ hash: v1.k794b7964.7181cda23c5cca64ec249b584e2131423d8c0a59ae82d90d706c299d59e43db6.urS-gTejpJOfQnmNssOHEK4jZ7t3yJEnMBfaM4TgbNY
scenes-app-marketing-analytics-recommendations--no-sources--dark:
hash: v1.k794b7964.063052d5d1be49433dbfb7c0c4b31c09d493afa2e9d8f138cec2966ac3f71089.OHLVA25PfjtZS0UoPTaX9Zyx3Yy3vbl7oroS6qE3z80
scenes-app-marketing-analytics-recommendations--no-sources--light:
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 0c1d1895d30f..8f74aa0c96db 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -36315,6 +36315,13 @@
"rule": {
"$ref": "#/definitions/MarketingAnalyticsRecommendationRule"
},
+ "steps": {
+ "description": "How to apply the recommendation in Google Ads, in order. Empty when the rule has no steps yet.",
+ "items": {
+ "$ref": "#/definitions/MarketingAnalyticsRecommendationStep"
+ },
+ "type": "array"
+ },
"subject": {
"description": "The campaign name or the search term the recommendation is about.",
"type": "string"
@@ -36350,6 +36357,28 @@
],
"type": "string"
},
+ "MarketingAnalyticsRecommendationStep": {
+ "additionalProperties": false,
+ "properties": {
+ "copyValue": {
+ "description": "Text to paste into Google Ads at this step, such as a campaign name or a keyword in match type syntax.",
+ "type": ["string", "null"]
+ },
+ "linkText": {
+ "description": "The words in `text` that link to `url`, usually the section name.",
+ "type": ["string", "null"]
+ },
+ "text": {
+ "type": "string"
+ },
+ "url": {
+ "description": "Google Ads page for this step. It opens the section for the whole account, because links cannot filter to one campaign.",
+ "type": ["string", "null"]
+ }
+ },
+ "required": ["text"],
+ "type": "object"
+ },
"MarketingAnalyticsRecommendationsQuery": {
"additionalProperties": false,
"properties": {
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 488faf16ac37..7ca5febab890 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -8589,6 +8589,16 @@ export type MarketingAnalyticsRecommendationImpactDirection = 'save' | 'gain' |
export type MarketingAnalyticsRecommendationImpactType = 'measured' | 'estimated'
+export interface MarketingAnalyticsRecommendationStep {
+ text: string
+ /** Text to paste into Google Ads at this step, such as a campaign name or a keyword in match type syntax. */
+ copyValue?: string | null
+ /** Google Ads page for this step. It opens the section for the whole account, because links cannot filter to one campaign. */
+ url?: string | null
+ /** The words in `text` that link to `url`, usually the section name. */
+ linkText?: string | null
+}
+
export interface MarketingAnalyticsRecommendation {
rule: MarketingAnalyticsRecommendationRule
level: MarketingAnalyticsRecommendationLevel
@@ -8603,6 +8613,8 @@ export interface MarketingAnalyticsRecommendation {
impactDirection: MarketingAnalyticsRecommendationImpactDirection
impactType: MarketingAnalyticsRecommendationImpactType
currency?: string | null
+ /** How to apply the recommendation in Google Ads, in order. Empty when the rule has no steps yet. */
+ steps?: MarketingAnalyticsRecommendationStep[]
}
export interface MarketingAnalyticsRecommendationsQueryResponse extends AnalyticsQueryResponseBase {
diff --git a/posthog/schema.py b/posthog/schema.py
index bbdeb67a2170..08945bcb9fc3 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -2224,6 +2224,30 @@ class MarketingAnalyticsDrillDownConfig(BaseModel):
excludesConversionGoals: bool | None = None
+class MarketingAnalyticsRecommendationStep(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ copyValue: str | None = Field(
+ default=None,
+ description=(
+ "Text to paste into Google Ads at this step, such as a campaign name or a keyword in match type syntax."
+ ),
+ )
+ linkText: str | None = Field(
+ default=None,
+ description="The words in `text` that link to `url`, usually the section name.",
+ )
+ text: str
+ url: str | None = Field(
+ default=None,
+ description=(
+ "Google Ads page for this step. It opens the section for the whole account,"
+ " because links cannot filter to one campaign."
+ ),
+ )
+
+
class MarketingAnalyticsSearchConversion(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -6904,6 +6928,10 @@ class MarketingAnalyticsRecommendation(BaseModel):
level: MarketingAnalyticsRecommendationLevel
reason: str
rule: MarketingAnalyticsRecommendationRule
+ steps: list[MarketingAnalyticsRecommendationStep] | None = Field(
+ default=None,
+ description=("How to apply the recommendation in Google Ads, in order. Empty when the rule has no steps yet."),
+ )
subject: str = Field(
...,
description="The campaign name or the search term the recommendation is about.",
diff --git a/products/marketing_analytics/backend/hogql_queries/marketing_recommendations.py b/products/marketing_analytics/backend/hogql_queries/marketing_recommendations.py
index 2a382a5a829d..d99ba386d76f 100644
--- a/products/marketing_analytics/backend/hogql_queries/marketing_recommendations.py
+++ b/products/marketing_analytics/backend/hogql_queries/marketing_recommendations.py
@@ -5,7 +5,11 @@ from typing import Literal
import tldextract
-from posthog.schema import MarketingAnalyticsRecommendation, MarketingAnalyticsRecommendationRule
+from posthog.schema import (
+ MarketingAnalyticsRecommendation,
+ MarketingAnalyticsRecommendationRule,
+ MarketingAnalyticsRecommendationStep as Step,
+)
from posthog.dataclasses import frozen
@@ -60,6 +64,12 @@ DOMAIN_PARTS = tldextract.TLDExtract(suffix_list_urls=(), include_psl_private_do
Direction = Literal["save", "gain", "invest", "keep"]
# Google Ads KeywordMatchType values, for tables that stored the enum number.
MATCH_TYPES = {"2": "EXACT", "3": "PHRASE", "4": "BROAD"}
+# Google Ads pages for the whole account. A link cannot open one campaign, because that needs an
+# interface id the API does not return, so steps also copy the campaign name to search for.
+ADS_CAMPAIGNS_URL = "https://ads.google.com/aw/campaigns"
+ADS_KEYWORDS_URL = "https://ads.google.com/aw/keywords"
+ADS_NEGATIVE_KEYWORDS_URL = "https://ads.google.com/aw/keywords/negative"
+ADS_SEARCH_TERMS_URL = "https://ads.google.com/aw/keywords/searchterms"
@frozen
@@ -143,6 +153,12 @@ class _BrandSpend:
top_term: str
+@frozen
+class _Advice:
+ action: str
+ steps: tuple[Step, ...]
+
+
def _site_brand(site_url: str) -> str | None:
match = SITE_HOST.match(site_url.lower())
if not match:
@@ -306,12 +322,37 @@ class _Recommender:
cost, conversions, top_term = leak.cost, leak.conversions, leak.top_term
share = cost / max(self._term_cost(campaign.id), 1)
brand = next((brand for brand in self.brands if brand in top_term.replace(" ", "")), top_term)
- # Performance Max takes no negative keywords; brand exclusions are its equivalent.
- action = (
- f'Add a brand exclusion for "{brand}"'
- if campaign.channel_type == "PERFORMANCE_MAX"
- else f'Add "{brand}" as a negative keyword'
+ check = Step(
+ text="After a week, check the campaign's search terms. If misspellings of your brand still show, "
+ "add each one the same way.",
+ url=ADS_SEARCH_TERMS_URL,
+ linkText="search terms",
)
+ # Performance Max takes no negative keywords; brand exclusions are its equivalent.
+ if campaign.channel_type == "PERFORMANCE_MAX":
+ action = f'Add a brand exclusion for "{brand}"'
+ steps = (
+ self._open_campaign(campaign.name),
+ Step(text="Open the campaign settings, go to Brand exclusions, and create a brand list."),
+ Step(text="Add your brand to the list and save it.", copyValue=brand),
+ check,
+ )
+ else:
+ action = f'Add "{brand}" as a negative keyword'
+ steps = (
+ self._open_campaign(campaign.name),
+ Step(
+ text="Open Negative keywords and add one for this campaign.",
+ url=ADS_NEGATIVE_KEYWORDS_URL,
+ linkText="Negative keywords",
+ ),
+ Step(
+ text="Paste this keyword. The quotes make it phrase match, so it blocks searches that contain it "
+ "spelled this way.",
+ copyValue=f'"{brand}"',
+ ),
+ check,
+ )
follow_up = (
"Your brand campaign can serve them at a lower cost."
if has_brand_campaign
@@ -327,6 +368,7 @@ class _Recommender:
cost * self.per_month,
"save",
"measured",
+ steps=steps,
)
def _scale(
@@ -427,12 +469,13 @@ class _Recommender:
self._term_recommendation(
MarketingAnalyticsRecommendationRule.SPEND_WITHOUT_CONVERSIONS,
term,
- self._no_conversion_action(term, competitors),
+ advice.action,
f"Spent {self._money(term.cost)} ({term.cost / cpa:.1f}x the account CPA) "
f"on {term.clicks:.0f} clicks with no conversions",
term.cost,
"save",
"measured",
+ steps=advice.steps,
)
for term in terms
if term.term not in self.brand_terms
@@ -440,6 +483,7 @@ class _Recommender:
and term.cost >= 2 * cpa
and term.status in ("NONE", "")
and self._serving(term)
+ for advice in (self._no_conversion_advice(term, competitors),)
]
if self.organic:
if average_cpc:
@@ -476,17 +520,65 @@ class _Recommender:
ordered.extend(sorted(rules.get(rule, []), key=lambda rec: -(rec.impact or 0))[:PER_RULE_LIMIT])
return ordered
- def _no_conversion_action(self, term: _Term, competitors: set[str]) -> str:
+ def _no_conversion_advice(self, term: _Term, competitors: set[str]) -> _Advice:
keyword = self.top_keyword.get(term.term)
match_type = MATCH_TYPES.get(keyword.match_type, keyword.match_type).lower() if keyword else ""
+ open_campaign = self._open_campaign(self._campaign_name(term))
+ exact = f"[{term.term}]"
+ negative = Step(
+ text="Open Negative keywords and add this one for the campaign. The brackets make it exact match, "
+ "so it blocks only this search.",
+ copyValue=exact,
+ url=ADS_NEGATIVE_KEYWORDS_URL,
+ linkText="Negative keywords",
+ )
if self._mentions(term.term, competitors):
matched_by = f' It matched the keyword "{keyword.keyword}" ({match_type} match).' if keyword else ""
- return f"Competitor term: decide whether conquesting is worth it.{matched_by}"
+ return _Advice(
+ action=f"Competitor term: decide whether conquesting is worth it.{matched_by}",
+ steps=(
+ open_campaign,
+ Step(
+ text="If showing on this search is not worth it, open Negative keywords and add it "
+ "for the campaign in exact match.",
+ copyValue=exact,
+ url=ADS_NEGATIVE_KEYWORDS_URL,
+ linkText="Negative keywords",
+ ),
+ ),
+ )
if not keyword:
- return "Review the bid and landing page, or add it as a negative"
+ return _Advice(
+ action="Review the bid and landing page, or add it as a negative", steps=(open_campaign, negative)
+ )
if match_type in ("broad", "phrase") and keyword.keyword.lower() != term.term:
- return f'Add it as a negative, or change the keyword "{keyword.keyword}" from {match_type} to exact match'
- return f'Review the keyword "{keyword.keyword}" ({match_type} match) and its landing page, or pause it'
+ return _Advice(
+ action=f'Add it as a negative, or change the keyword "{keyword.keyword}" from {match_type} to exact match',
+ steps=(
+ open_campaign,
+ negative,
+ Step(
+ text="Or, to stop similar searches too, open Keywords, find this keyword, "
+ "and change its match type to exact.",
+ copyValue=keyword.keyword,
+ url=ADS_KEYWORDS_URL,
+ linkText="Keywords",
+ ),
+ ),
+ )
+ return _Advice(
+ action=f'Review the keyword "{keyword.keyword}" ({match_type} match) and its landing page, or pause it',
+ steps=(
+ open_campaign,
+ Step(
+ text="Open Keywords, find this keyword, and check its bid and final URL.",
+ copyValue=keyword.keyword,
+ url=ADS_KEYWORDS_URL,
+ linkText="Keywords",
+ ),
+ Step(text="If the bid and the page look right and it still does not convert, pause the keyword."),
+ ),
+ )
def _brand_overlap(self, terms: list[_Term], cpa: float) -> list[MarketingAnalyticsRecommendation]:
recommendations = []
@@ -545,12 +637,13 @@ class _Recommender:
return recommendations
def _keyword_gap(
- self, average_cpc: float, vocabulary: set[str], competitors: set[str]
+ self, average_cpc: float, vocabulary: dict[str, dict[str, float]], competitors: set[str]
) -> list[MarketingAnalyticsRecommendation]:
has_search = any(
campaign.channel_type == "SEARCH" and campaign.primary_status not in INACTIVE_STATUSES
for campaign in self.campaigns.values()
)
+ channel = "SEARCH" if has_search else "PERFORMANCE_MAX"
impressions = sorted(query.impressions for query in self.organic.values())
threshold = impressions[int(len(impressions) * 0.95)] if impressions else 0
recommendations = []
@@ -563,6 +656,31 @@ class _Recommender:
matched = [word for word in words if word in vocabulary]
if not words or len(matched) < len(words):
continue
+ campaign = self._campaign_for_words(matched, vocabulary, channel)
+ if has_search:
+ steps: tuple[Step, ...] = (
+ self._open_campaign(
+ campaign.name if campaign else None,
+ fallback="In Google Ads, open Campaigns and pick the search campaign closest to this topic, "
+ "or create one.",
+ ),
+ Step(
+ text="Open Keywords and add this one to an ad group of the campaign. The quotes make it "
+ "phrase match, so it also matches longer searches that contain it.",
+ copyValue=f'"{query.query}"',
+ url=ADS_KEYWORDS_URL,
+ linkText="Keywords",
+ ),
+ Step(text="Check that the ad and the landing page answer this search."),
+ )
+ else:
+ steps = (
+ self._open_campaign(
+ campaign.name if campaign else None,
+ fallback="In Google Ads, open Campaigns and pick your Performance Max campaign.",
+ ),
+ Step(text="Open the asset group and add this search theme.", copyValue=query.query),
+ )
recommendations.append(
self._recommendation(
MarketingAnalyticsRecommendationRule.KEYWORD_GAP,
@@ -574,10 +692,29 @@ class _Recommender:
query.impressions * TOP3_CTR * average_cpc * self.per_month,
"invest",
"estimated",
+ campaign.name if campaign else None,
+ steps=steps,
)
)
return recommendations
+ def _campaign_for_words(
+ self, words: list[str], vocabulary: dict[str, dict[str, float]], channel: str
+ ) -> CampaignStats | None:
+ # The campaign with the most conversions on searches that use the query's words already serves the topic.
+ conversions: dict[str, float] = defaultdict(float)
+ for word in words:
+ for campaign_id, count in vocabulary.get(word, {}).items():
+ conversions[campaign_id] += count
+ candidates = [
+ campaign
+ for campaign_id in conversions
+ if (campaign := self.campaigns.get(campaign_id))
+ and campaign.channel_type == channel
+ and campaign.primary_status not in INACTIVE_STATUSES
+ ]
+ return max(candidates, key=lambda campaign: conversions[campaign.id], default=None)
+
# Helpers
def _aggregate_terms(self) -> dict[str, _Term]:
@@ -657,18 +794,22 @@ class _Recommender:
cost=max(campaign.cost - leak.cost, 0), conversions=max(campaign.conversions - leak.conversions, 0)
)
- def _vocabulary(self, terms: list[_Term], cpa: float | None) -> set[str]:
+ def _vocabulary(self, terms: list[_Term], cpa: float | None) -> dict[str, dict[str, float]]:
# Words from non-brand terms that convert at or below the account CPA: the account's own
# definition of a relevant search. Terms that convert only at a high cost do not count.
- return {
- word
- for term in terms
- if term.conversions > 0
- and term.term not in self.brand_terms
- and (cpa is None or term.cost / term.conversions <= cpa)
- for word in term.term.split()
- if len(word) >= 3 and word not in GENERIC_WORDS
- }
+ # Each word maps to the conversions per campaign of the terms that contain it.
+ vocabulary: dict[str, dict[str, float]] = defaultdict(lambda: defaultdict(float))
+ for term in terms:
+ if (
+ term.conversions <= 0
+ or term.term in self.brand_terms
+ or (cpa is not None and term.cost / term.conversions > cpa)
+ ):
+ continue
+ for word in term.term.split():
+ if len(word) >= 3 and word not in GENERIC_WORDS:
+ vocabulary[word][term.top_campaign_id] += term.conversions
+ return vocabulary
def _competitor_names(self) -> set[str]:
queries = set(self.organic) | set(self.terms)
@@ -706,6 +847,24 @@ class _Recommender:
campaign = self.campaigns.get(term.top_campaign_id)
return campaign is None or campaign.primary_status not in INACTIVE_STATUSES
+ def _campaign_name(self, term: _Term) -> str | None:
+ campaign = self.campaigns.get(term.top_campaign_id)
+ return campaign.name if campaign else None
+
+ @staticmethod
+ def _open_campaign(
+ name: str | None,
+ fallback: str = "In Google Ads, open Campaigns and pick the campaign that shows ads for this search.",
+ ) -> Step:
+ if name is None:
+ return Step(text=fallback, url=ADS_CAMPAIGNS_URL, linkText="Campaigns")
+ return Step(
+ text="In Google Ads, open Campaigns and search for this campaign.",
+ copyValue=name,
+ url=ADS_CAMPAIGNS_URL,
+ linkText="Campaigns",
+ )
+
def _term_recommendation(
self,
rule: MarketingAnalyticsRecommendationRule,
@@ -715,8 +874,8 @@ class _Recommender:
impact: float,
direction: Direction,
impact_type: Literal["measured", "estimated"],
+ steps: tuple[Step, ...] = (),
) -> MarketingAnalyticsRecommendation:
- campaign = self.campaigns.get(term.top_campaign_id)
return self._recommendation(
rule,
"search_term",
@@ -726,7 +885,8 @@ class _Recommender:
impact * self.per_month,
direction,
impact_type,
- campaign.name if campaign else None,
+ self._campaign_name(term),
+ steps=steps,
)
def _recommendation(
@@ -740,6 +900,7 @@ class _Recommender:
direction: Direction,
impact_type: Literal["measured", "estimated"],
campaign: str | None = None,
+ steps: tuple[Step, ...] = (),
) -> MarketingAnalyticsRecommendation:
return MarketingAnalyticsRecommendation(
rule=rule,
@@ -752,6 +913,7 @@ class _Recommender:
impactDirection=direction,
impactType=impact_type,
currency=self.inputs.currency,
+ steps=list(steps),
)
def _money(self, amount: float) -> str:
diff --git a/products/marketing_analytics/backend/hogql_queries/test_marketing_recommendations.py b/products/marketing_analytics/backend/hogql_queries/test_marketing_recommendations.py
index 8fea00e6fa84..7626f3c31618 100644
--- a/products/marketing_analytics/backend/hogql_queries/test_marketing_recommendations.py
+++ b/products/marketing_analytics/backend/hogql_queries/test_marketing_recommendations.py
@@ -124,6 +124,7 @@ class TestMarketingRecommendations(SimpleTestCase):
leak = next(rec for rec in recs if rec.rule == "brand_leak")
assert (leak.subject, leak.action) == ("Generic", 'Add "example" as a negative keyword')
+ assert [step.copyValue for step in leak.steps or [] if step.copyValue] == ["Generic", '"example"']
assert not any(rec.rule == "scale_campaign" and rec.subject == "Generic" for rec in recs)
@parameterized.expand(
@@ -156,18 +157,25 @@ class TestMarketingRecommendations(SimpleTestCase):
]
)
def test_keyword_gap_needs_every_meaningful_word_to_convert(self, _name: str, query: str, expected: bool) -> None:
- campaign = _campaign()
+ campaigns = (_campaign(id="c2", name="Replay"), _campaign())
terms = (
_term("funnel tracking", "c1", cost=100, conversions=10),
_term("analysis software", "c1", cost=100, conversions=10),
_term("spy", "c1", cost=1000, conversions=1),
+ _term("session replay", "c2", cost=100, conversions=10),
)
organic = tuple(OrganicQueryStats(query=f"filler {i}", clicks=1, impressions=1, position=50) for i in range(30))
organic += (OrganicQueryStats(query=query, clicks=1, impressions=5000, position=25),)
- gaps = [rec.subject for rec in recommend(_inputs((campaign,), terms, organic)) if rec.rule == "keyword_gap"]
+ gaps = {
+ rec.subject: rec.campaign
+ for rec in recommend(_inputs(campaigns, terms, organic))
+ if rec.rule == "keyword_gap"
+ }
assert (query in gaps) == expected
+ if expected:
+ assert gaps[query] == "Search"
def test_performance_max_gets_brand_exclusion_and_rank_advice(self) -> None:
pmax = _campaign(
@@ -182,15 +190,15 @@ class TestMarketingRecommendations(SimpleTestCase):
_term("project planning software", "pmax", cost=700, conversions=8),
)
- actions = {
- (rec.rule.value, rec.action) for rec in recommend(_inputs((pmax,), terms)) if rec.level == "campaign"
- }
+ recs = [rec for rec in recommend(_inputs((pmax,), terms)) if rec.level == "campaign"]
- assert actions == {
+ assert {(rec.rule.value, rec.action) for rec in recs} == {
("brand_leak", 'Add a brand exclusion for "example"'),
("scale_campaign", "Raise the target CPA or improve its asset groups"),
("policy_limited", "Check the affected ads in Policy manager"),
}
+ leak = next(rec for rec in recs if rec.rule == "brand_leak")
+ assert [step.copyValue for step in leak.steps or [] if step.copyValue] == ["PMax", "example"]
@parameterized.expand(
[
@@ -198,17 +206,32 @@ class TestMarketingRecommendations(SimpleTestCase):
"broad",
"BROAD",
'Add it as a negative, or change the keyword "website traffic" from broad to exact match',
+ [
+ ("Search", "campaigns"),
+ ("[spy website traffic]", "keywords/negative"),
+ ("website traffic", "keywords"),
+ ],
),
(
"phrase_enum_number",
"3",
'Add it as a negative, or change the keyword "website traffic" from phrase to exact match',
+ [
+ ("Search", "campaigns"),
+ ("[spy website traffic]", "keywords/negative"),
+ ("website traffic", "keywords"),
+ ],
+ ),
+ (
+ "exact",
+ "EXACT",
+ 'Review the keyword "website traffic" (exact match) and its landing page, or pause it',
+ [("Search", "campaigns"), ("website traffic", "keywords")],
),
- ("exact", "EXACT", 'Review the keyword "website traffic" (exact match) and its landing page, or pause it'),
]
)
def test_spend_without_conversions_names_the_keyword_that_matched(
- self, _name: str, match_type: str, expected: str
+ self, _name: str, match_type: str, expected: str, expected_copy: list[tuple[str, str]]
) -> None:
terms = (
_term("spy website traffic", "c1", cost=500, conversions=0),
@@ -219,13 +242,19 @@ class TestMarketingRecommendations(SimpleTestCase):
TermKeywordStats(term="spy website traffic", keyword="traffic", match_type="BROAD", cost=100),
)
- actions = [
- rec.action
+ recs = [
+ rec
for rec in recommend(_inputs((_campaign(),), terms, term_keywords=keywords))
if rec.rule == "spend_without_conversions"
]
- assert actions == [expected]
+ assert [rec.action for rec in recs] == [expected]
+ assert [
+ (step.copyValue, (step.url or "").removeprefix("https://ads.google.com/aw/"))
+ for step in recs[0].steps or []
+ if step.copyValue
+ ] == expected_copy
+ assert all(step.linkText and step.linkText in step.text for step in recs[0].steps or [] if step.url)
@parameterized.expand([("serving", "ELIGIBLE", 1), ("paused", "PAUSED", 0), ("removed", "REMOVED", 0)])
def test_spend_without_conversions_skips_campaigns_that_do_not_serve(
diff --git a/products/marketing_analytics/frontend/recommendations/RecommendationStepText.tsx b/products/marketing_analytics/frontend/recommendations/RecommendationStepText.tsx
new file mode 100644
index 000000000000..22f26d981f27
--- /dev/null
+++ b/products/marketing_analytics/frontend/recommendations/RecommendationStepText.tsx
@@ -0,0 +1,24 @@
+import { Link } from 'lib/lemon-ui/Link'
+
+import { MarketingAnalyticsRecommendationStep } from '~/queries/schema/schema-general'
+
+export function RecommendationStepText({ step }: { step: MarketingAnalyticsRecommendationStep }): JSX.Element {
+ const start = step.url && step.linkText ? step.text.indexOf(step.linkText) : -1
+ if (!step.url || !step.linkText || start < 0) {
+ return <span>{step.text}</span>
+ }
+ return (
+ <span>
+ <span>{step.text.slice(0, start)}</span>
+ <Link
+ to={step.url}
+ target="_blank"
+ targetBlankIcon
+ data-attr="marketing-recommendations-step-open-google-ads"
+ >
+ {step.linkText}
+ </Link>
+ <span>{step.text.slice(start + step.linkText.length)}</span>
+ </span>
+ )
+}
diff --git a/products/marketing_analytics/frontend/recommendations/RecommendationSteps.tsx b/products/marketing_analytics/frontend/recommendations/RecommendationSteps.tsx
new file mode 100644
index 000000000000..9d6ec683c034
--- /dev/null
+++ b/products/marketing_analytics/frontend/recommendations/RecommendationSteps.tsx
@@ -0,0 +1,29 @@
+import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
+
+import { MarketingAnalyticsRecommendationStep } from '~/queries/schema/schema-general'
+
+import { RecommendationStepText } from './RecommendationStepText'
+
+export function RecommendationSteps({ steps }: { steps: MarketingAnalyticsRecommendationStep[] }): JSX.Element {
+ return (
+ <ol className="m-0 flex list-decimal flex-col gap-2 py-2 pl-5">
+ {steps.map((step, index) => (
+ <li key={index}>
+ <RecommendationStepText step={step} />
+ {step.copyValue && (
+ <div className="mt-1">
+ <CopyToClipboardInline
+ description="value"
+ iconSize="xsmall"
+ className="rounded border bg-surface-primary px-1.5 py-0.5 font-mono text-xs"
+ data-attr="marketing-recommendations-step-copy"
+ >
+ {step.copyValue}
+ </CopyToClipboardInline>
+ </div>
+ )}
+ </li>
+ ))}
+ </ol>
+ )
+}
diff --git a/products/marketing_analytics/frontend/recommendations/RecommendationsModal.tsx b/products/marketing_analytics/frontend/recommendations/RecommendationsModal.tsx
index 944a8fe06088..7d62a0a7bfca 100644
--- a/products/marketing_analytics/frontend/recommendations/RecommendationsModal.tsx
+++ b/products/marketing_analytics/frontend/recommendations/RecommendationsModal.tsx
@@ -1,6 +1,7 @@
import { BindLogic } from 'kea'
-import { useRef } from 'react'
+import { useRef, useState } from 'react'
+import { IconChevronDown, IconChevronRight } from '@posthog/icons'
import {
LemonBadge,
LemonBanner,
@@ -33,6 +34,7 @@ import {
RecommendationSection,
RecommendationTotal,
} from './recommendations'
+import { RecommendationSteps } from './RecommendationSteps'
const DIRECTION_TAG: Record<MarketingAnalyticsRecommendation['impactDirection'], LemonTagType> = {
save: 'success',
@@ -71,12 +73,31 @@ function ImpactTotals({ totals }: { totals: RecommendationTotal[] }): JSX.Elemen
)
}
+function rowKey(row: MarketingAnalyticsRecommendation, index: number): string {
+ return `${row.rule}-${row.subject}-${row.campaign ?? ''}-${index}`
+}
+
function RecommendationRows({ rows }: { rows: MarketingAnalyticsRecommendation[] }): JSX.Element {
+ const [expanded, setExpanded] = useState<Set<string>>(new Set())
+ const toggle = (key: string): void =>
+ setExpanded((current) => {
+ const next = new Set(current)
+ if (!next.delete(key)) {
+ next.add(key)
+ }
+ return next
+ })
return (
<LemonTable<MarketingAnalyticsRecommendation>
size="small"
dataSource={rows}
- rowKey={(row, index) => `${row.rule}-${row.subject}-${row.campaign ?? ''}-${index}`}
+ rowKey={rowKey}
+ expandable={{
+ expandedRowRender: (row) => <RecommendationSteps steps={row.steps ?? []} />,
+ rowExpandable: (row) => (row.steps?.length ? 1 : 0),
+ isRowExpanded: (row, index) => expanded.has(rowKey(row, index)),
+ showRowExpansionToggle: false,
+ }}
columns={[
{
title: 'For',
@@ -92,12 +113,27 @@ function RecommendationRows({ rows }: { rows: MarketingAnalyticsRecommendation[]
{
title: 'Recommendation',
key: 'action',
- render: (_, row) => (
- <div className="flex flex-col gap-0.5 py-1">
- <span>{row.action}</span>
- <span className="text-xs text-secondary">{row.reason}</span>
- </div>
- ),
+ render: (_, row, index) => {
+ const key = rowKey(row, index)
+ return (
+ <div className="flex flex-col items-start gap-0.5 py-1">
+ <span>{row.action}</span>
+ <span className="text-xs text-secondary">{row.reason}</span>
+ {!!row.steps?.length && (
+ <LemonButton
+ size="xsmall"
+ type="tertiary"
+ className="-ml-1 mt-0.5"
+ sideIcon={expanded.has(key) ? <IconChevronDown /> : <IconChevronRight />}
+ onClick={() => toggle(key)}
+ data-attr="marketing-recommendations-view-instructions"
+ >
+ {expanded.has(key) ? 'Hide instructions' : 'View instructions'}
+ </LemonButton>
+ )}
+ </div>
+ )
+ },
},
{
title: 'Impact',
diff --git a/products/marketing_analytics/frontend/recommendations/RecommendationsSection.stories.tsx b/products/marketing_analytics/frontend/recommendations/RecommendationsSection.stories.tsx
index 40d15059ff6d..0cfe6b380b3d 100644
--- a/products/marketing_analytics/frontend/recommendations/RecommendationsSection.stories.tsx
+++ b/products/marketing_analytics/frontend/recommendations/RecommendationsSection.stories.tsx
@@ -100,6 +100,26 @@ const RESULTS: MarketingAnalyticsRecommendation[] = [
action: 'Add it as a negative, or change the keyword "analytics template" from broad to exact match',
reason: 'Spent $640 (6.4x the account CPA) on 210 clicks with no conversions',
impact: 640,
+ steps: [
+ {
+ text: 'In Google Ads, open Campaigns and search for this campaign.',
+ copyValue: 'Search - Generic',
+ url: 'https://ads.google.com/aw/campaigns',
+ linkText: 'Campaigns',
+ },
+ {
+ text: 'Open Negative keywords and add this one for the campaign. The brackets make it exact match, so it blocks only this search.',
+ copyValue: '[free analytics template]',
+ url: 'https://ads.google.com/aw/keywords/negative',
+ linkText: 'Negative keywords',
+ },
+ {
+ text: 'Or, to stop similar searches too, open Keywords, find this keyword, and change its match type to exact.',
+ copyValue: 'analytics template',
+ url: 'https://ads.google.com/aw/keywords',
+ linkText: 'Keywords',
+ },
+ ],
}),
recommendation({
rule: 'spend_without_conversions',
@@ -267,6 +287,16 @@ export const Modal: Story = {
},
}
+export const ModalInstructions: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ await userEvent.click(await canvas.findByText('Recommendations', { selector: 'button *' }))
+ const modal = within(canvasElement.ownerDocument.body)
+ await userEvent.click(await modal.findByText('Spend without conversions', { selector: 'button *' }))
+ await userEvent.click(await modal.findByText('View instructions'))
+ },
+}
+
export const NoSources: Story = {
parameters: {
msw: {
diff --git a/products/marketing_analytics/mcp/prompts/query-marketing-recommendations.md b/products/marketing_analytics/mcp/prompts/query-marketing-recommendations.md
index a77d0e80e303..047849aa7054 100644
--- a/products/marketing_analytics/mcp/prompts/query-marketing-recommendations.md
+++ b/products/marketing_analytics/mcp/prompts/query-marketing-recommendations.md
@@ -16,10 +16,11 @@ Do not use it for attribution, conversion goals, or channel performance. Use `ma
Each result has:
- `rule` — the check that produced it, for example `spend_without_conversions`, `brand_leak`, `budget_constrained`, `scale_campaign`, `review_campaign`, `brand_overlap`, `content_gap`, `keyword_gap`, `striking_distance` or `policy_limited`.
-- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to.
+- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to. For `keyword_gap`, `campaign` is the campaign to add the keyword to, because the search is not bought yet.
- `action` and `reason` — what to do and the numbers behind it. Quote them instead of inventing your own advice.
- `impact` — the monthly money impact in `currency`, or null. `impactDirection` says how to read it: `save` is spend to cut, `invest` is extra budget to add, `gain` is value to win, and `keep` is spend to protect.
- `impactType` — `measured` comes straight from the data. `estimated` is a projection, so present it as an estimate.
+- `steps` — how to apply the recommendation in the Google Ads interface, in order. A step's `copyValue` is the exact text to paste, such as a campaign name or a keyword in match type syntax (`[term]` is exact match, `"term"` is phrase match). A step's `url` opens the Google Ads section named by `linkText`, for the whole account. When the user asks how to make a change, walk them through these steps. Some rules have no steps yet.
Totals in different currencies come from different ad accounts. Never add them together.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 8bf420b13768..e5ed62d9e935 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -11939,7 +11939,7 @@
"system_prompt_hint": "Log filtering by severity/service/attribute"
},
"query-marketing-recommendations": {
- "description": "Get paid and organic search recommendations for the project's Google Ads accounts, built from synced Google Ads and Google Search Console warehouse tables. Mirrors the recommendations in the in-product **Marketing analytics** scene.\n\n# When to use\n\nUse this tool when the user asks where to cut ad spend, which campaigns to scale or review, which search terms waste money, or how paid and organic search overlap.\n\nDo not use it for attribution, conversion goals, or channel performance. Use `marketing-analytics-diagnose` when the data looks missing or wrong.\n\n# Inputs\n\n- `dateRange` — pass `{ \"date_from\": \"-30d\" }` unless the user asks for another period. Short ranges give few recommendations, because the rules need enough clicks and spend to compare.\n- Leave everything else out. The tool reads every synced Google Ads and Google Search Console source in the project.\n\n# Output\n\nEach result has:\n\n- `rule` — the check that produced it, for example `spend_without_conversions`, `brand_leak`, `budget_constrained`, `scale_campaign`, `review_campaign`, `brand_overlap`, `content_gap`, `keyword_gap`, `striking_distance` or `policy_limited`.\n- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to.\n- `action` and `reason` — what to do and the numbers behind it. Quote them instead of inventing your own advice.\n- `impact` — the monthly money impact in `currency`, or null. `impactDirection` says how to read it: `save` is spend to cut, `invest` is extra budget to add, `gain` is value to win, and `keep` is spend to protect.\n- `impactType` — `measured` comes straight from the data. `estimated` is a projection, so present it as an estimate.\n\nTotals in different currencies come from different ad accounts. Never add them together.\n\nPresent the results as suggestions for the user to evaluate, not as instructions. Always show the response's `disclaimer` text with them. Do not change campaigns, budgets, bids or keywords on the user's behalf.\n\nAn empty result means no rule fired, or the project has no synced Google Ads `campaign` and `campaign_stats` tables. Call `marketing-analytics-data-sources` to tell the two apart.\n\n# Example\n\n```json\n{\n \"kind\": \"MarketingAnalyticsRecommendationsQuery\",\n \"dateRange\": { \"date_from\": \"-30d\" }\n}\n```",
+ "description": "Get paid and organic search recommendations for the project's Google Ads accounts, built from synced Google Ads and Google Search Console warehouse tables. Mirrors the recommendations in the in-product **Marketing analytics** scene.\n\n# When to use\n\nUse this tool when the user asks where to cut ad spend, which campaigns to scale or review, which search terms waste money, or how paid and organic search overlap.\n\nDo not use it for attribution, conversion goals, or channel performance. Use `marketing-analytics-diagnose` when the data looks missing or wrong.\n\n# Inputs\n\n- `dateRange` — pass `{ \"date_from\": \"-30d\" }` unless the user asks for another period. Short ranges give few recommendations, because the rules need enough clicks and spend to compare.\n- Leave everything else out. The tool reads every synced Google Ads and Google Search Console source in the project.\n\n# Output\n\nEach result has:\n\n- `rule` — the check that produced it, for example `spend_without_conversions`, `brand_leak`, `budget_constrained`, `scale_campaign`, `review_campaign`, `brand_overlap`, `content_gap`, `keyword_gap`, `striking_distance` or `policy_limited`.\n- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to. For `keyword_gap`, `campaign` is the campaign to add the keyword to, because the search is not bought yet.\n- `action` and `reason` — what to do and the numbers behind it. Quote them instead of inventing your own advice.\n- `impact` — the monthly money impact in `currency`, or null. `impactDirection` says how to read it: `save` is spend to cut, `invest` is extra budget to add, `gain` is value to win, and `keep` is spend to protect.\n- `impactType` — `measured` comes straight from the data. `estimated` is a projection, so present it as an estimate.\n- `steps` — how to apply the recommendation in the Google Ads interface, in order. A step's `copyValue` is the exact text to paste, such as a campaign name or a keyword in match type syntax (`[term]` is exact match, `\"term\"` is phrase match). A step's `url` opens the Google Ads section named by `linkText`, for the whole account. When the user asks how to make a change, walk them through these steps. Some rules have no steps yet.\n\nTotals in different currencies come from different ad accounts. Never add them together.\n\nPresent the results as suggestions for the user to evaluate, not as instructions. Always show the response's `disclaimer` text with them. Do not change campaigns, budgets, bids or keywords on the user's behalf.\n\nAn empty result means no rule fired, or the project has no synced Google Ads `campaign` and `campaign_stats` tables. Call `marketing-analytics-data-sources` to tell the two apart.\n\n# Example\n\n```json\n{\n \"kind\": \"MarketingAnalyticsRecommendationsQuery\",\n \"dateRange\": { \"date_from\": \"-30d\" }\n}\n```",
"category": "Marketing analytics",
"feature": "marketing_analytics",
"summary": "Get paid and organic search recommendations",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index e6c27c62b08f..cc6c496382c2 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -12625,7 +12625,7 @@
"system_prompt_hint": "Log filtering by severity/service/attribute"
},
"query-marketing-recommendations": {
- "description": "Get paid and organic search recommendations for the project's Google Ads accounts, built from synced Google Ads and Google Search Console warehouse tables. Mirrors the recommendations in the in-product **Marketing analytics** scene.\n\n# When to use\n\nUse this tool when the user asks where to cut ad spend, which campaigns to scale or review, which search terms waste money, or how paid and organic search overlap.\n\nDo not use it for attribution, conversion goals, or channel performance. Use `marketing-analytics-diagnose` when the data looks missing or wrong.\n\n# Inputs\n\n- `dateRange` — pass `{ \"date_from\": \"-30d\" }` unless the user asks for another period. Short ranges give few recommendations, because the rules need enough clicks and spend to compare.\n- Leave everything else out. The tool reads every synced Google Ads and Google Search Console source in the project.\n\n# Output\n\nEach result has:\n\n- `rule` — the check that produced it, for example `spend_without_conversions`, `brand_leak`, `budget_constrained`, `scale_campaign`, `review_campaign`, `brand_overlap`, `content_gap`, `keyword_gap`, `striking_distance` or `policy_limited`.\n- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to.\n- `action` and `reason` — what to do and the numbers behind it. Quote them instead of inventing your own advice.\n- `impact` — the monthly money impact in `currency`, or null. `impactDirection` says how to read it: `save` is spend to cut, `invest` is extra budget to add, `gain` is value to win, and `keep` is spend to protect.\n- `impactType` — `measured` comes straight from the data. `estimated` is a projection, so present it as an estimate.\n\nTotals in different currencies come from different ad accounts. Never add them together.\n\nPresent the results as suggestions for the user to evaluate, not as instructions. Always show the response's `disclaimer` text with them. Do not change campaigns, budgets, bids or keywords on the user's behalf.\n\nAn empty result means no rule fired, or the project has no synced Google Ads `campaign` and `campaign_stats` tables. Call `marketing-analytics-data-sources` to tell the two apart.\n\n# Example\n\n```json\n{\n \"kind\": \"MarketingAnalyticsRecommendationsQuery\",\n \"dateRange\": { \"date_from\": \"-30d\" }\n}\n```",
+ "description": "Get paid and organic search recommendations for the project's Google Ads accounts, built from synced Google Ads and Google Search Console warehouse tables. Mirrors the recommendations in the in-product **Marketing analytics** scene.\n\n# When to use\n\nUse this tool when the user asks where to cut ad spend, which campaigns to scale or review, which search terms waste money, or how paid and organic search overlap.\n\nDo not use it for attribution, conversion goals, or channel performance. Use `marketing-analytics-diagnose` when the data looks missing or wrong.\n\n# Inputs\n\n- `dateRange` — pass `{ \"date_from\": \"-30d\" }` unless the user asks for another period. Short ranges give few recommendations, because the rules need enough clicks and spend to compare.\n- Leave everything else out. The tool reads every synced Google Ads and Google Search Console source in the project.\n\n# Output\n\nEach result has:\n\n- `rule` — the check that produced it, for example `spend_without_conversions`, `brand_leak`, `budget_constrained`, `scale_campaign`, `review_campaign`, `brand_overlap`, `content_gap`, `keyword_gap`, `striking_distance` or `policy_limited`.\n- `level` — `campaign` or `search_term`. `subject` is the campaign name or the search term, and `campaign` is the campaign a search term belongs to. For `keyword_gap`, `campaign` is the campaign to add the keyword to, because the search is not bought yet.\n- `action` and `reason` — what to do and the numbers behind it. Quote them instead of inventing your own advice.\n- `impact` — the monthly money impact in `currency`, or null. `impactDirection` says how to read it: `save` is spend to cut, `invest` is extra budget to add, `gain` is value to win, and `keep` is spend to protect.\n- `impactType` — `measured` comes straight from the data. `estimated` is a projection, so present it as an estimate.\n- `steps` — how to apply the recommendation in the Google Ads interface, in order. A step's `copyValue` is the exact text to paste, such as a campaign name or a keyword in match type syntax (`[term]` is exact match, `\"term\"` is phrase match). A step's `url` opens the Google Ads section named by `linkText`, for the whole account. When the user asks how to make a change, walk them through these steps. Some rules have no steps yet.\n\nTotals in different currencies come from different ad accounts. Never add them together.\n\nPresent the results as suggestions for the user to evaluate, not as instructions. Always show the response's `disclaimer` text with them. Do not change campaigns, budgets, bids or keywords on the user's behalf.\n\nAn empty result means no rule fired, or the project has no synced Google Ads `campaign` and `campaign_stats` tables. Call `marketing-analytics-data-sources` to tell the two apart.\n\n# Example\n\n```json\n{\n \"kind\": \"MarketingAnalyticsRecommendationsQuery\",\n \"dateRange\": { \"date_from\": \"-30d\" }\n}\n```",
"category": "Marketing analytics",
"feature": "marketing_analytics",
"summary": "Get paid and organic search recommendations",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index a316566486df..cef24c91c136 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -61998,6 +61998,16 @@ export namespace Schemas {
StrikingDistance: 'striking_distance',
} as const;
+ export interface MarketingAnalyticsRecommendationStep {
+ /** Text to paste into Google Ads at this step, such as a campaign name or a keyword in match type syntax. */
+ copyValue?: string | null;
+ /** The words in `text` that link to `url`, usually the section name. */
+ linkText?: string | null;
+ text: string;
+ /** Google Ads page for this step. It opens the section for the whole account, because links cannot filter to one campaign. */
+ url?: string | null;
+ }
+
export interface MarketingAnalyticsRecommendation {
action: string;
/** The campaign a search term recommendation applies to, when it applies to one. */
@@ -62010,6 +62020,8 @@ export namespace Schemas {
level: MarketingAnalyticsRecommendationLevel;
reason: string;
rule: MarketingAnalyticsRecommendationRule;
+ /** How to apply the recommendation in Google Ads, in order. Empty when the rule has no steps yet. */
+ steps?: MarketingAnalyticsRecommendationStep[] | null;
/** The campaign name or the search term the recommendation is about. */
subject: string;
}