: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(marketing-analytics): correct misleading utm audit source pills (#74681)
Xander7378554da5ec
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/UtmAuditTab/UtmAuditTab.tsx b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/UtmAuditTab/UtmAuditTab.tsxindex 7ca46bacb254..51cb1ada6cf0 100644--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/UtmAuditTab/UtmAuditTab.tsx+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/UtmAuditTab/UtmAuditTab.tsx@@ -24,7 +24,13 @@ import {} from '~/queries/schema/schema-general'import { marketingAnalyticsSettingsLogic } from '../../logic/marketingAnalyticsSettingsLogic'-import type { AggregatedUtmSource, CampaignAuditResult, HealthTab, UtmEvent } from '../../logic/utmAuditLogic'+import type {+ AggregatedUtmSource,+ CampaignAuditResult,+ HealthTab,+ UtmEvent,+ UtmIssueKind,+} from '../../logic/utmAuditLogic'import { utmAuditLogic } from '../../logic/utmAuditLogic'import { NonIntegratedConversionsCellActions } from '../NonIntegratedConversionsTable/NonIntegratedConversionsCellActions'import { CampaignFieldPreferencesConfiguration } from '../settings/CampaignFieldPreferencesConfiguration'@@ -59,6 +65,66 @@ function sourceLabel(source: string): string {return DISPLAY_NAMES[source] || source}+// Keyed by the generated issue-kind union, so a new kind added on the backend fails the typecheck+// here instead of silently falling back to the wrong label.+const ISSUE_LABELS: Record<UtmIssueKind, string> = {+ not_linked: 'Not linked',+ missing_source: 'Missing source',+ name_collision: 'Name collision',+ no_tagged_events: 'Source mismatch',+ unknown_source: 'Source mismatch',+}++function joinSources(sources: string[]): string {+ if (sources.length < 2) {+ return sources[0] ?? ''+ }+ return `${sources.slice(0, -1).join(', ')} or ${sources[sources.length - 1]}`+}++// Compose scoped, honest text for a campaign's status pill. The pill label is intentionally+// terse; this explains what the audit actually found for this specific campaign.+function issueTooltip(record: CampaignAuditResult): string {+ const issue = record.issues[0]+ if (!issue) {+ return ''+ }+ const platform = sourceLabel(record.source_name)+ const fix = `Add utm_source=${record.source_name} to your ${platform} tracking URLs.`+ // A campaign is classified by its mistagged pageviews, so untagged ones ride along as an extra+ // sentence rather than disappearing. Zero on kinds where it can't happen.+ const untagged = issue.missing_source_count ?? 0+ const untaggedNote =+ untagged > 0 ? ` A further ${formatNumber(untagged)} pageviews arrived with no utm_source at all.` : ''++ switch (issue.kind) {+ case 'not_linked':+ return `No pageviews were found for this campaign. Check that your ${platform} tracking URLs include utm_source and utm_campaign.`+ case 'missing_source':+ return `${formatNumber(untagged)} pageviews reached this campaign with no utm_source set, so they can't be attributed to ${platform}. ${fix}`+ case 'name_collision': {+ const shared = (issue.shared_with_integrations ?? []).map(sourceLabel).join(', ') || 'another integration'+ return `This campaign's name is also used by ${shared}. Switch to matching on campaign ID so they can be told apart.${untaggedNote}`+ }+ case 'no_tagged_events':+ case 'unknown_source': {+ const sources = joinSources((issue.alternative_sources ?? []).map((s) => s.utm_source).filter(Boolean))+ if (!sources) {+ return issue.message+ }+ return `Pageviews matched this campaign, but their utm_source was ${sources}, not ${record.source_name}. ${fix}${untaggedNote}`+ }+ default:+ return issue.message+ }+}++// Short pill label reflecting the issue kind. The tooltip carries the full explanation.+function issueLabel(record: CampaignAuditResult): string {+ const kind = record.issues[0]?.kind+ return (kind && ISSUE_LABELS[kind]) || 'Source mismatch'+}+function formatCurrency(value: number, currency: string = 'USD'): string {return new Intl.NumberFormat('en-US', { style: 'currency', currency, maximumFractionDigits: 0 }).format(value)}@@ -201,13 +267,13 @@ function CampaignTabContent(): JSX.Element {}const issue = record.issues[0]return (- <Tooltip title={issue.message}>+ <Tooltip title={issueTooltip(record)}><span><LemonTagtype={issue.severity === 'error' ? 'danger' : 'warning'}icon={<IconWarning />}>- {issue.severity === 'error' ? 'Not linked' : 'Source mismatch'}+ {issueLabel(record)}</LemonTag></span></Tooltip>diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utmAuditLogic.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utmAuditLogic.tsindex 6089c195024b..fe5cc6564415 100644--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utmAuditLogic.ts+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utmAuditLogic.ts@@ -11,28 +11,24 @@ import {VALID_NATIVE_MARKETING_SOURCES,} from '~/queries/schema/schema-general'+import type {+ CampaignAuditResultApi,+ UtmAlternativeSourceApi,+ UtmIssueApi,+ UtmIssueKindEnumApi,+} from 'products/marketing_analytics/frontend/generated/api.schemas'+import type { CurrencyCode } from '../../../../../../queries/schema/schema-general'import { similarityScore } from '../components/settings/stringSimilarity'import { marketingAnalyticsSettingsLogic } from './marketingAnalyticsSettingsLogic'import { MARKETING_ANALYTICS_DATA_COLLECTION_NODE_ID } from './marketingAnalyticsTilesLogic'-export interface UtmIssue {- field: string- severity: 'error' | 'warning'- message: string-}--export interface CampaignAuditResult {- campaign_name: string- campaign_id: string- source_name: string- spend: number- clicks: number- impressions: number- has_utm_events: boolean- event_count: number- issues: UtmIssue[]-}+// Shapes come from the audit endpoint's serializers, so they're taken from the generated types+// rather than restated here — the issue kinds in particular must not drift from the backend enum.+export type UtmIssueKind = UtmIssueKindEnumApi+export type UtmAlternativeSource = UtmAlternativeSourceApi+export type UtmIssue = UtmIssueApi+export type CampaignAuditResult = CampaignAuditResultApiexport type MatchType = 'none' | 'auto' | 'mapped'diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 4f32d1c74262..e7a6528df141 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -589,6 +589,7 @@ SPECTACULAR_SETTINGS = {"EmailReputationScopeEnum": "products.workflows.backend.models.email_reputation.EmailReputationSnapshot.Scope","EmailReputationStateEnum": "products.workflows.backend.models.email_reputation.EmailReputationSnapshot.State","MCPAuthTypeEnum": "products.mcp_store.backend.models.AUTH_TYPE_CHOICES",+ "UtmIssueKindEnum": "products.marketing_analytics.backend.services.types.UTM_ISSUE_KIND_CHOICES",# Shared by ConversionGoalSummary.kind and GoalExplanation.kind (same choice set)."ConversionGoalKindEnum": "products.marketing_analytics.backend.hogql_queries.constants.CONVERSION_GOAL_KIND_CHOICES","MCPInstallationScopeEnum": ["personal", "shared"],diff --git a/products/marketing_analytics/backend/api.py b/products/marketing_analytics/backend/api.pyindex 4b1238e51a88..50043e4700d5 100644--- a/products/marketing_analytics/backend/api.py+++ b/products/marketing_analytics/backend/api.py@@ -35,6 +35,7 @@ from products.marketing_analytics.backend.services.data_source_health import getfrom products.marketing_analytics.backend.services.event_suggestions import suggest_conversion_goalsfrom products.marketing_analytics.backend.services.mapping_suggester import suggest_utm_mappingsfrom products.marketing_analytics.backend.services.marketing_diagnostic import get_marketing_diagnostic+from products.marketing_analytics.backend.services.types import UTM_ISSUE_KIND_CHOICESfrom products.marketing_analytics.backend.services.utm_audit import run_utm_auditfrom products.warehouse_sources.backend.facade.models import DataWarehouseTable@@ -65,10 +66,34 @@ class UtmAuditQuerySerializer(serializers.Serializer):)+class UtmAlternativeSourceSerializer(serializers.Serializer):+ utm_source = serializers.CharField(help_text="A utm_source value found on this campaign's pageviews")+ event_count = serializers.IntegerField(help_text="Number of pageview events with this utm_source")++class UtmIssueSerializer(serializers.Serializer):field = serializers.CharField(help_text="The UTM field with the issue (e.g. utm_campaign, utm_source)")severity = serializers.ChoiceField(choices=["error", "warning"], help_text="Issue severity level")- message = serializers.CharField(help_text="Human-readable description of the issue")+ # `kind` collides with other enums in drf-spectacular, so it carries a stable name via+ # ENUM_NAME_OVERRIDES ("UtmIssueKindEnum") rather than being flattened to a plain string —+ # consumers get the five values as a union instead of having to restate them.+ kind = serializers.ChoiceField(+ choices=UTM_ISSUE_KIND_CHOICES,+ help_text="Which kind of UTM problem this campaign has",+ )+ message = serializers.CharField(+ help_text="Human-readable headline; the frontend composes richer text from the fields below"+ )+ alternative_sources = UtmAlternativeSourceSerializer(+ many=True, help_text="utm_source values actually found on this campaign's pageviews, ordered by event count"+ )+ shared_with_integrations = serializers.ListField(+ child=serializers.CharField(),+ help_text="Other integrations whose campaigns share this campaign's name (name_collision only)",+ )+ missing_source_count = serializers.IntegerField(+ help_text="Pageviews that matched this campaign but carried no utm_source, on any issue kind"+ )class CampaignAuditResultSerializer(serializers.Serializer):diff --git a/products/marketing_analytics/backend/services/test_utm_audit.py b/products/marketing_analytics/backend/services/test_utm_audit.pyindex f2bd5e830b61..aac53701c592 100644--- a/products/marketing_analytics/backend/services/test_utm_audit.py+++ b/products/marketing_analytics/backend/services/test_utm_audit.py@@ -252,6 +252,47 @@ class TestCrossReferenceIssueKinds:assert len(issue.alternative_sources) == 1assert issue.alternative_sources[0].utm_source == "partner_xyz"+ def test_missing_source_when_events_have_no_utm_source(self):+ # Pageviews match the campaign name but carry no utm_source (e.g. auto-tagged Performance Max).+ # Must not be classified as UNKNOWN_SOURCE, and must not suggest mapping an empty source.+ campaigns = [Campaign("Performance Max - Generic", "1", "google", 500.0, 100, 5000)]+ utm_events = {("performance max - generic", ""): 222}++ results = _cross_reference(campaigns, utm_events, NO_MAPPINGS, DEFAULT_KNOWN_SOURCES)++ issue = results[0].issues[0]+ assert issue.kind == UtmIssueKind.MISSING_SOURCE+ assert issue.severity == UtmIssueSeverity.WARNING+ assert issue.alternative_sources == []+ assert issue.missing_source_count == 222+ assert issue.suggested_actions == [SuggestedAction.FIX_PLATFORM_URLS]++ def test_partly_tagged_campaign_keeps_both_the_wrong_source_and_the_untagged_count(self):+ # The shape that motivated MISSING_SOURCE, but only half the pageviews are untagged. The wrong+ # source is the actionable classification, so it wins the kind — the untagged ones must still+ # be reported rather than dropped, since fixing the URLs has to cover both.+ campaigns = [Campaign("Performance Max - Generic", "1", "google", 500.0, 100, 5000)]+ utm_events = {+ ("performance max - generic", ""): 222,+ ("performance max - generic", "partner_xyz"): 30,+ }++ results = _cross_reference(campaigns, utm_events, NO_MAPPINGS, DEFAULT_KNOWN_SOURCES)++ issue = results[0].issues[0]+ assert issue.kind == UtmIssueKind.UNKNOWN_SOURCE+ assert [alt.utm_source for alt in issue.alternative_sources] == ["partner_xyz"]+ assert issue.missing_source_count == 222++ def test_untagged_count_is_zero_when_every_pageview_carries_a_source(self):+ # Guards the other direction: the count must not leak in from unrelated events.+ campaigns = [Campaign("Brand", "1", "google", 500.0, 100, 5000)]+ utm_events = {("brand", "facebook"): 40}++ results = _cross_reference(campaigns, utm_events, NO_MAPPINGS, DEFAULT_KNOWN_SOURCES)++ assert results[0].issues[0].missing_source_count == 0+def test_name_collision_when_another_platform_matches_same_name(self):# Both Bing and Google have "Survey". Events only tag google.# Google's row passes; Bing's row should be NAME_COLLISION with SWITCH_TO_ID_MATCH as primary fix.diff --git a/products/marketing_analytics/backend/services/types.py b/products/marketing_analytics/backend/services/types.pyindex 6a0ba9d86e07..30d7bb0488ff 100644--- a/products/marketing_analytics/backend/services/types.py+++ b/products/marketing_analytics/backend/services/types.py@@ -21,6 +21,15 @@ class UtmIssueKind(StrEnum):# Campaign name matches events with a utm_source unknown to every integration.# Safe to suggest a custom source mapping as an alternative to fixing the URLs.UNKNOWN_SOURCE = "unknown_source"+ # Campaign name matches events, but they carry no utm_source at all (empty/missing).+ # Common for auto-tagged campaigns (e.g. Performance Max) that set utm_campaign only.+ MISSING_SOURCE = "missing_source"+++# Choice list for the API serializer. Derived from the enum so the two can't drift, and referenced+# by name from SPECTACULAR_SETTINGS["ENUM_NAME_OVERRIDES"] so the generated schema keeps a stable+# enum name instead of a hash-suffixed one.+UTM_ISSUE_KIND_CHOICES = [kind.value for kind in UtmIssueKind]class SuggestedAction(StrEnum):@@ -59,6 +68,10 @@ class UtmIssue:message: str = ""alternative_sources: list[AlternativeSource] = dataclass_field(default_factory=list)shared_with_integrations: list[str] = dataclass_field(default_factory=list)+ # Pageviews that matched the campaign but carried no utm_source. Reported on every kind, not+ # just MISSING_SOURCE: a partly-tagged campaign is classified by its mistagged half, and+ # dropping this count would hide the rest of the problem from whoever has to fix the URLs.+ missing_source_count: int = 0# Ordered list of suggested remediations. First entry is the primary recommendation.suggested_actions: list[SuggestedAction] = dataclass_field(default_factory=list)diff --git a/products/marketing_analytics/backend/services/utm_audit.py b/products/marketing_analytics/backend/services/utm_audit.pyindex 588a3a3bc0d6..3990a7df5a93 100644--- a/products/marketing_analytics/backend/services/utm_audit.py+++ b/products/marketing_analytics/backend/services/utm_audit.py@@ -388,6 +388,8 @@ class _CampaignStats:match_display: strexact_count: intalt_source_counts: dict[str, int]+ # Events matching the campaign name but carrying no utm_source (empty/missing).+ missing_source_count: intdef _compute_campaign_stats(@@ -411,8 +413,12 @@ def _compute_campaign_stats(source_counts[utm_source] = source_counts.get(utm_source, 0) + countexact_count = 0+ missing_source_count = 0alt_source_counts: dict[str, int] = {}for utm_source, count in source_counts.items():+ if not utm_source:+ missing_source_count += count+ continueresolved_source = _resolve_source(utm_source, mappings)if resolved_source == source_name_lower or utm_source == source_name_lower:exact_count += count@@ -426,6 +432,7 @@ def _compute_campaign_stats(match_display=match_display,exact_count=exact_count,alt_source_counts=alt_source_counts,+ missing_source_count=missing_source_count,)@@ -436,6 +443,7 @@ _HEADLINE_BY_KIND: dict[UtmIssueKind, str] = {UtmIssueKind.NAME_COLLISION: "Campaign name also used on {shared}",UtmIssueKind.NO_TAGGED_EVENTS: _NO_TAGGED_EVENTS_HEADLINE,UtmIssueKind.UNKNOWN_SOURCE: _NO_TAGGED_EVENTS_HEADLINE,+ UtmIssueKind.MISSING_SOURCE: "Pageviews for '{campaign}' have no utm_source set",}@@ -478,11 +486,24 @@ def _build_issue(message=_make_headline(UtmIssueKind.NAME_COLLISION, platform, stats.match_display, shared_with_sorted),alternative_sources=alternative_sources,shared_with_integrations=shared_with_sorted,+ missing_source_count=stats.missing_source_count,suggested_actions=[SuggestedAction.SWITCH_TO_ID_MATCH, SuggestedAction.FIX_PLATFORM_URLS],)- # No events at all, and no other integration claims this name → just fix the URLs.+ # No alternative source events. Either the campaign has pageviews with no utm_source at+ # all (missing tag — common for auto-tagged campaigns) or no matching pageviews whatsoever.if not alternative_sources:+ if stats.missing_source_count > 0:+ return UtmIssue(+ field="utm_source",+ severity=UtmIssueSeverity.WARNING,+ kind=UtmIssueKind.MISSING_SOURCE,+ message=_make_headline(UtmIssueKind.MISSING_SOURCE, platform, stats.match_display, []),+ alternative_sources=[],+ shared_with_integrations=[],+ missing_source_count=stats.missing_source_count,+ suggested_actions=[SuggestedAction.FIX_PLATFORM_URLS],+ )return UtmIssue(field="utm_campaign",severity=UtmIssueSeverity.ERROR,@@ -506,6 +527,7 @@ def _build_issue(message=_make_headline(UtmIssueKind.UNKNOWN_SOURCE, platform, stats.match_display, []),alternative_sources=alternative_sources,shared_with_integrations=[],+ missing_source_count=stats.missing_source_count,suggested_actions=[SuggestedAction.FIX_PLATFORM_URLS, SuggestedAction.ADD_SOURCE_MAPPING],)@@ -516,6 +538,7 @@ def _build_issue(message=_make_headline(UtmIssueKind.NO_TAGGED_EVENTS, platform, stats.match_display, []),alternative_sources=alternative_sources,shared_with_integrations=[],+ missing_source_count=stats.missing_source_count,suggested_actions=[SuggestedAction.FIX_PLATFORM_URLS],)diff --git a/products/marketing_analytics/frontend/generated/api.schemas.ts b/products/marketing_analytics/frontend/generated/api.schemas.tsindex 917caa560882..904fe274f28d 100644--- a/products/marketing_analytics/frontend/generated/api.schemas.ts+++ b/products/marketing_analytics/frontend/generated/api.schemas.ts@@ -481,6 +481,30 @@ export const UtmIssueSeverityEnumApi = {Warning: 'warning',} as const+/**+ * * `not_linked` - not_linked+ * * `name_collision` - name_collision+ * * `no_tagged_events` - no_tagged_events+ * * `unknown_source` - unknown_source+ * * `missing_source` - missing_source+ */+export type UtmIssueKindEnumApi = (typeof UtmIssueKindEnumApi)[keyof typeof UtmIssueKindEnumApi]++export const UtmIssueKindEnumApi = {+ NotLinked: 'not_linked',+ NameCollision: 'name_collision',+ NoTaggedEvents: 'no_tagged_events',+ UnknownSource: 'unknown_source',+ MissingSource: 'missing_source',+} as const++export interface UtmAlternativeSourceApi {+ /** A utm_source value found on this campaign's pageviews */+ utm_source: string+ /** Number of pageview events with this utm_source */+ event_count: number+}+export interface UtmIssueApi {/** The UTM field with the issue (e.g. utm_campaign, utm_source) */field: string@@ -489,8 +513,22 @@ export interface UtmIssueApi {* * `error` - error* * `warning` - warning */severity: UtmIssueSeverityEnumApi- /** Human-readable description of the issue */+ /** Which kind of UTM problem this campaign has+ *+ * * `not_linked` - not_linked+ * * `name_collision` - name_collision+ * * `no_tagged_events` - no_tagged_events+ * * `unknown_source` - unknown_source+ * * `missing_source` - missing_source */+ kind: UtmIssueKindEnumApi+ /** Human-readable headline; the frontend composes richer text from the fields below */message: string+ /** utm_source values actually found on this campaign's pageviews, ordered by event count */+ alternative_sources: UtmAlternativeSourceApi[]+ /** Other integrations whose campaigns share this campaign's name (name_collision only) */+ shared_with_integrations: string[]+ /** Pageviews that matched this campaign but carried no utm_source, on any issue kind */+ missing_source_count: number}export interface CampaignAuditResultApi {diff --git a/products/marketing_analytics/frontend/generated/api.zod.schemas.ts b/products/marketing_analytics/frontend/generated/api.zod.schemas.tsindex 89bfca8a118e..0fe3d4903b30 100644--- a/products/marketing_analytics/frontend/generated/api.zod.schemas.ts+++ b/products/marketing_analytics/frontend/generated/api.zod.schemas.ts@@ -897,13 +897,52 @@ export const UtmIssueSeverityEnumApi = zodexport type UtmIssueSeverityEnumApi = zod.input<typeof UtmIssueSeverityEnumApi>export type UtmIssueSeverityEnumApiOutput = zod.output<typeof UtmIssueSeverityEnumApi>+export const UtmIssueKindEnumApi = zod+ .enum(['not_linked', 'name_collision', 'no_tagged_events', 'unknown_source', 'missing_source'])+ .describe(+ '\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ )++export type UtmIssueKindEnumApi = zod.input<typeof UtmIssueKindEnumApi>+export type UtmIssueKindEnumApiOutput = zod.output<typeof UtmIssueKindEnumApi>++export const UtmAlternativeSourceApi = zod.object({+ utm_source: zod.string().describe("A utm_source value found on this campaign's pageviews"),+ event_count: zod.number().describe('Number of pageview events with this utm_source'),+})++export type UtmAlternativeSourceApi = zod.input<typeof UtmAlternativeSourceApi>+export type UtmAlternativeSourceApiOutput = zod.output<typeof UtmAlternativeSourceApi>+export const UtmIssueApi = zod.object({field: zod.string().describe('The UTM field with the issue (e.g. utm_campaign, utm_source)'),severity: zod.enum(['error', 'warning']).describe('\* `error` - error\n\* `warning` - warning').describe('Issue severity level\n\n\* `error` - error\n\* `warning` - warning'),- message: zod.string().describe('Human-readable description of the issue'),+ kind: zod+ .enum(['not_linked', 'name_collision', 'no_tagged_events', 'unknown_source', 'missing_source'])+ .describe(+ '\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ )+ .describe(+ 'Which kind of UTM problem this campaign has\n\n\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ ),+ message: zod.string().describe('Human-readable headline; the frontend composes richer text from the fields below'),+ alternative_sources: zod+ .array(+ zod.object({+ utm_source: zod.string().describe("A utm_source value found on this campaign's pageviews"),+ event_count: zod.number().describe('Number of pageview events with this utm_source'),+ })+ )+ .describe("utm_source values actually found on this campaign's pageviews, ordered by event count"),+ shared_with_integrations: zod+ .array(zod.string())+ .describe("Other integrations whose campaigns share this campaign's name (name_collision only)"),+ missing_source_count: zod+ .number()+ .describe('Pageviews that matched this campaign but carried no utm_source, on any issue kind'),})export type UtmIssueApi = zod.input<typeof UtmIssueApi>@@ -926,7 +965,31 @@ export const CampaignAuditResultApi = zod.object({.enum(['error', 'warning']).describe('\* `error` - error\n\* `warning` - warning').describe('Issue severity level\n\n\* `error` - error\n\* `warning` - warning'),- message: zod.string().describe('Human-readable description of the issue'),+ kind: zod+ .enum(['not_linked', 'name_collision', 'no_tagged_events', 'unknown_source', 'missing_source'])+ .describe(+ '\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ )+ .describe(+ 'Which kind of UTM problem this campaign has\n\n\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ ),+ message: zod+ .string()+ .describe('Human-readable headline; the frontend composes richer text from the fields below'),+ alternative_sources: zod+ .array(+ zod.object({+ utm_source: zod.string().describe("A utm_source value found on this campaign's pageviews"),+ event_count: zod.number().describe('Number of pageview events with this utm_source'),+ })+ )+ .describe("utm_source values actually found on this campaign's pageviews, ordered by event count"),+ shared_with_integrations: zod+ .array(zod.string())+ .describe("Other integrations whose campaigns share this campaign's name (name_collision only)"),+ missing_source_count: zod+ .number()+ .describe('Pageviews that matched this campaign but carried no utm_source, on any issue kind'),})).describe('List of detected UTM configuration issues'),@@ -990,7 +1053,49 @@ export const UtmAuditResponseApi = zod.object({.enum(['error', 'warning']).describe('\* `error` - error\n\* `warning` - warning').describe('Issue severity level\n\n\* `error` - error\n\* `warning` - warning'),- message: zod.string().describe('Human-readable description of the issue'),+ kind: zod+ .enum([+ 'not_linked',+ 'name_collision',+ 'no_tagged_events',+ 'unknown_source',+ 'missing_source',+ ])+ .describe(+ '\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ )+ .describe(+ 'Which kind of UTM problem this campaign has\n\n\* `not_linked` - not_linked\n\* `name_collision` - name_collision\n\* `no_tagged_events` - no_tagged_events\n\* `unknown_source` - unknown_source\n\* `missing_source` - missing_source'+ ),+ message: zod+ .string()+ .describe(+ 'Human-readable headline; the frontend composes richer text from the fields below'+ ),+ alternative_sources: zod+ .array(+ zod.object({+ utm_source: zod+ .string()+ .describe("A utm_source value found on this campaign's pageviews"),+ event_count: zod+ .number()+ .describe('Number of pageview events with this utm_source'),+ })+ )+ .describe(+ "utm_source values actually found on this campaign's pageviews, ordered by event count"+ ),+ shared_with_integrations: zod+ .array(zod.string())+ .describe(+ "Other integrations whose campaigns share this campaign's name (name_collision only)"+ ),+ missing_source_count: zod+ .number()+ .describe(+ 'Pageviews that matched this campaign but carried no utm_source, on any issue kind'+ ),})).describe('List of detected UTM configuration issues'),diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 9ced314caf41..ab66dee2a1e9 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -12774,6 +12774,31 @@ export namespace Schemas {Warning: 'warning',} as const;+ /**+ * * `not_linked` - not_linked+ * * `name_collision` - name_collision+ * * `no_tagged_events` - no_tagged_events+ * * `unknown_source` - unknown_source+ * * `missing_source` - missing_source+ */+ export type UtmIssueKindEnum = typeof UtmIssueKindEnum[keyof typeof UtmIssueKindEnum];+++ export const UtmIssueKindEnum = {+ NotLinked: 'not_linked',+ NameCollision: 'name_collision',+ NoTaggedEvents: 'no_tagged_events',+ UnknownSource: 'unknown_source',+ MissingSource: 'missing_source',+ } as const;++ export interface UtmAlternativeSource {+ /** A utm_source value found on this campaign's pageviews */+ utm_source: string;+ /** Number of pageview events with this utm_source */+ event_count: number;+ }+export interface UtmIssue {/** The UTM field with the issue (e.g. utm_campaign, utm_source) */field: string;@@ -12782,8 +12807,22 @@ export namespace Schemas {* * `error` - error* * `warning` - warning */severity: UtmIssueSeverityEnum;- /** Human-readable description of the issue */+ /** Which kind of UTM problem this campaign has+ *+ * * `not_linked` - not_linked+ * * `name_collision` - name_collision+ * * `no_tagged_events` - no_tagged_events+ * * `unknown_source` - unknown_source+ * * `missing_source` - missing_source */+ kind: UtmIssueKindEnum;+ /** Human-readable headline; the frontend composes richer text from the fields below */message: string;+ /** utm_source values actually found on this campaign's pageviews, ordered by event count */+ alternative_sources: UtmAlternativeSource[];+ /** Other integrations whose campaigns share this campaign's name (name_collision only) */+ shared_with_integrations: string[];+ /** Pageviews that matched this campaign but carried no utm_source, on any issue kind */+ missing_source_count: number;}export interface CampaignAuditResult {