I'm running the following query in an attempt to replicate a report I created in the UI with these same columns:
"""
SELECT
campaign.name,
segments.device,
ad_group_criterion.criterion_id,
ad_group_criterion.keyword.text,
ad_group_criterion.position_estimates.first_page_cpc_micros,
ad_group_criterion.position_estimates.top_of_page_cpc_micros,
ad_group_criterion.position_estimates.first_position_cpc_micros,
metrics.average_cpc,
metrics.clicks,
metrics.conversions
FROM
keyword_view
WHERE
segments.date DURING LAST_30_DAYS
AND ad_group_criterion.status = 'ENABLED'
AND ad_group_criterion.negative = 'False'
"""
Again, the target report in the UI has these same columns and includes filters for "Search keyword status is Eligible" and the past 30 days. Since the API queries only return device types for Mobile, Tablet, and Desktop, I also filtered the UI report's device column accordingly. Both are pulling data from the same Account ID.
I can get the row counts for both tables to match exactly if I:
1. Remove the segments.device column from each report.
2. Remove the "Search Keyword Status" filter ("Enabled") from the UI report. For some reason the "WHERE ad_group_criterion.status = 'Enabled' clause in my query doesn't seem to do anything. Are Search Keyword Status and ad_group_criterion.status referring to different things?
The row counts cease to match when I add the device column back (along with the status filter). Also, for some reason the API query returns a different number of rows when I change the segments.date filter, but the UI returns the same number of rows no matter what I put in the date range filter. This only happens when the segments.device column is present.
How can I make these reports match? And what is happening on the backend that produces the differences between these reports?
Regards,
Tanner