I’m using google ads script to pull some data to sheet. my goal is to get conversion Rate for each campaign.
this is my code
var campaignIterator = AdsApp.campaigns().get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
const stats = campaign.getStatsFor('LAST_MONTH');
console.log(campaign.getName()+ ', '+stats.getImpressions()+', '+stats.getConversionRate())
}
it always return 0 as Conversion Rate. but it should be 9.09 according to my data set.
I tried logging stats object too, seems the field related to ConversionRate is not even there.
output of console.log(stats)
{ metrics:
{ clicks: '11',
videoViews: '0',
conversions: 1,
costMicros: '10520000',
ctr: 0.125,
averageCpc: 956363.6363636364,
averageCpm: 119545454.54545455,
impressions: '88' } }
this what I see from the ad report front end
this is the API guide I’m using
https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_stats#getConversionRate_0
what am I doing wrong here ?