It seems that you can only see the aggregated performance on ad level i.e. you cannot know which of the headlines and descriptions were served when some impression happened. There is no api headline report or description report, so not sure where the data should come from
RSA headlines and descriptions need a bit of unpacking after they are returned. But after doing that you can at least see how Google think they are performing
Something like this approach to get you started:
function main() {
const query = `
SELECT
ad_group_ad.ad.responsive_search_ad.headlines,
ad_group_ad.ad.responsive_search_ad.descriptions,
metrics.impressions,
ad_group.name
FROM
ad_group_ad
WHERE
campaign.status = "ENABLED"
AND ad_group.status = "ENABLED"
AND ad_group_ad.status = "ENABLED"
AND segments.date DURING YESTERDAY
LIMIT 3`;
const response = AdsApp.search(query);
while (response.hasNext()) {
const row = response.next();
console.log(`\n*** adGroup: "${row.adGroup.name}", impr: ${row.metrics.impressions} ***`);
const jsonString = JSON.stringify(row);
const data = JSON.parse(jsonString);
findHeadlinesAndDescriptions(data);
}
}
function findHeadlinesAndDescriptions(obj, context) {
if (typeof obj === 'object') {
for (const key in obj) {
if (Array.isArray(obj[key])) {
for (const item of obj[key]) {
findHeadlinesAndDescriptions(item, key);
}
} else if (typeof obj[key] === 'object') {
findHeadlinesAndDescriptions(obj[key], key);
} else if (key === 'text') {
console.log(`${context === 'headlines' ? 'Headline' : 'Description'}: ${obj[key]}`);
} else if (key === 'assetPerformanceLabel') {
console.log(`Asset Performance Label: ${obj[key]}`);
}
}
}
}