I'm using the Google Analytics API Client for NodeJS and I'm exercising it using the following API call:
const {google} = require('googleapis');
const analyticsreporting = google.analyticsreporting('v4');
...
const res = await analyticsreporting.userActivity.search({
viewId,
user: {
type: 'CLIENT_ID',
userId: id
},
dateRange:{
startDate,
endDate
}
});
... and I've got it actually returning results which is great. The trouble is all the reports with activityType set to ecommerce are supposed to have a detail object bound to a field called ecommerce that among other things includes a transactionId that I'm critically interested in for my application. Instead of this detail in the ecommerce field, I seem to only get empty objects bound to it, like so {}.
If I go look at the same Activity information by navigating in the Google Analytics front-end to the Audience > User Explorer report table, sure enough I get the same set of activity records, but I can drill down to the e-commerce data here. Same result if I use the Google Analytics API Sandbox to make the request.
So how do I get this e-commerce object to be populated when I make an API call instead of using the Google Analytics reports interface? Any help would be most appreciated in helping me break through this problem, as it's the only thing left standing between me and my goal.