Posts tagged with google-api-nodejs-client

I am trying to find the total cost of google ads campaigns that are created via a particular manager account or via google ads api.

I tried the change event query where it gives me all the campaigns created via google ads but the issue is with change_event.change_date_time. It requires this filter otherwise it throws an error. Because of this filter, I am only getting campaigns that are created in this specific time period, but I need all campaigns.

SELECT   change_event.campaign FROM change_event WHERE   campaign.status != 'REMOVED'   AND change_event.change_date_time >= '${from_date}'   AND change_event.change_date_time <= '${to_date}'   AND change_event.client_type = 'GOOGLE_ADS_API' ORDER BY change_event.change_date_time ASC LIMIT 10000 

Reference Link: https://developers.google.com/google-ads/api/fields/v9/change_event_query_builder

I'm using google adwords api to create campaigns and ads. I keep getting this error :Unauthorized CREATE operation in invoking a service's mutate method. I'm using a manager account. I tried with a test account and it was working but with my manager account it doesnt. PS : My developer token has a basic access.

 const client = new GoogleAdsApi({   client_id: req.headers["client_id"],   client_secret: req.headers["client_secret"],   developer_token: req.headers["developer_token"], }); const customer = client.Customer({   customer_id: req.headers["customer_id"],   refresh_token: req.headers["refresh_token"], });   const ad_group_ad = [     {       ad: {         responsive_display_ad: {           accent_color: req.body.pubGads.couleurs_perso,           main_color: req.body.pubGads.couleurs_perso,           marketing_images: marketing_images_tab.map((element) => {             return {               asset: element,             };           }),           square_logo_images: square_logo_images_tab.map((element) => {             return {               asset: element,             };           }),           square_marketing_images: square_marketing_images_tab.map(             (element) => {               return {                 asset: element,               };             }           ),           headlines: headlinesTab.map((element) => {             return {               text: element,             };           }),           long_headline: {             text: req.body.pubGads.titre_long,           },           descriptions: descriptionsTab.map((element) => {             return {               text: element,             };           }),           business_name: req.body.pubGads.nom_entreprise,           call_to_action_text: req.body.pubGads.texte_incitation,         },         final_urls: req.body.pubGads.url_finale.split(","),       },       ad_group: adGroupResults.results[0].resource_name,       status: enums.AdGroupAdStatus.PAUSED,     },   ];   const ad_group_ad_result = await customer.adGroupAds.create(ad_group_ad);