Hi all,
I'm trying to fetch campaign data from a Google Ads client account via a
newly created MCC (manager) account using the google-ads-api library
(v21.0.1) in Node.js. I followed these steps:
-
Created my own MCC account.
-
Received and accepted an invitation from the client, giving me read-only
access to their account.
-
Verified the client account is showing under my MCC account in the
Google Ads UI.
-
Acquired OAuth refresh token (flow works, tokens issued).
-
Developer token is APPROVED for standard access.
-
Using client IDs and MCC IDs *without dashes*.
Here’s the code I’m running:
js
const { GoogleAdsApi, enums } = require('google-ads-api'); const client =
new GoogleAdsApi({ client_id: '...', client_secret: '...', developer_token:
'...', }); const customer = client.Customer({ customer_id: 'xxxxxxxxxx', //
client/customer account (no dashes) login_customer_id: 'yyyyyyyyyy', // my
MCC account (no dashes) refresh_token: '...', }); async function
fetchCampaigns() { try { const campaigns = await customer.report({ entity:
'campaign', attributes: ['campaign.id', 'campaign.name'], metrics: [
'metrics.impressions', 'metrics.clicks'], limit: 10, constraints: {
'campaign.status': enums.CampaignStatus.ENABLED, }, }); if (!campaigns ||
campaigns.length === 0) { console.log('No campaigns found'); return; }
campaigns.forEach(campaign => { console.log(`ID: ${campaign['campaign.id']},
Name: ${campaign['campaign.name']}`); }); } catch (error) {
console.error('Error
fetching campaigns:', error); } } fetchCampaigns();
But every run gives me this error:
text
No data type found for reason No data type found for domain No data type
found for metadata.service No data type found for metadata.method Error
fetching campaigns: TypeError: Cannot read properties of undefined (reading
'get') at Customer.getGoogleAdsError
(.../google-ads-api/build/src/service.js:102:49) ...
*Things I've already checked:*
-
Both IDs are correct and have full account access (client account
appears in MCC UI).
-
Developer token, OAuth credentials, and permissions should be valid.
-
Dashes have been removed from IDs.
-
Tried with and without login_customer_id.
-
Using latest Node 20+ and latest google-ads-api package.
*Questions:*
-
Is this error due to account permissions, API setup, or a bug in the
library?
-
Any additional steps needed after accepting a client account invitation
in MCC?
-
Should API access work for an MCC managing a client with read-only
access, or is higher permission needed?
-
Has anyone resolved this 'undefined get' error in google-ads-api/report?
Any help or insight would be greatly appreciated!
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/adwords-api/90e2aaba-e831-49e1-91b2-da4f1c409206n%40googlegroups.com.