I'm using the Google Analytics Data API v1beta to pull campaign-wise key events from my GA4 property, specifically tracking a custom event called Phone_Number_Click (configured via Google Tag Manager). However, I’m seeing a discrepancy between the UI and the API response. Here’s what I see for a specific campaign: Campaign ID Campaign Name Source keyEvents 225 Stroke-Rehab-Awareness-pmax GA4 UI 135.98 225 Stroke-Rehab-Awareness-pmax GA4 API 96.36 from google.analytics.data_v1beta import BetaAnalyticsDataClient from google.analytics.data_v1beta.types import RunReportRequest, DateRange, Dimension, Metric import pandas as pd import os os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path_to_key.json' client = BetaAnalyticsDataClient() request = RunReportRequest( property="properties/2812", dimensions=[ Dimension(name="campaignId"), Dimension(name="campaignName") ], metrics=[Metric(name="keyEvents")], date_ranges=[DateRange(start_date="yesterday", end_date="yesterday")], ) response = client.run_report(request) rows = [ { "Campaign ID": row.dimension_values[0].value, "Campaign": row.dimension_values[1].value, "keyEvents": row.metric_values[0].value } for row in response.rows ] df = pd.DataFrame(rows) print(df) My Questions: Does the Data API use the same attribution model as the GA4 UI? Is there a way to specify or align attribution settings in the API request? What can cause the API to return lower key events than the GA4 UI? Continue reading...