Posts under category Google

I want to develop a console application that pulls all campaigns under adwords accounts using Google Ads Api. But I could not pass the authentication step.

I do not fully understand whether I should use the Service Account or Desktop Application Flow for this process.

GoogleAdsConfig config = new GoogleAdsConfig()             {                 DeveloperToken = "Dev_token",                 OAuth2Mode = Google.Ads.GoogleAds.Config.OAuth2Flow.APPLICATION,                 OAuth2ClientId = "client_Id",                 OAuth2ClientSecret = "secrret",                 OAuth2RefreshToken = " refresh_token",              }; GoogleAdsClient client = new GoogleAdsClient(config); GoogleAdsServiceClient googleAdsService = client.GetService(Google.Ads.GoogleAds.Services.V10.GoogleAdsService); googleAdsService.SearchStream(AdwordsClientId, query,                 delegate (SearchGoogleAdsStreamResponse resp)                 {                     foreach (GoogleAdsRow adsRow in resp.Results)                     {                      }                 }             ); 

When I try as above, I get the following error

Google.Apis.Auth.OAuth2.Responses.TokenResponseException: Error:"unauthorized_client", Description:"Unauthorized", Uri:""

What paths should i follow? Thank you.

I am trying to handle keyword policy violation error in google ads api. I am trying the given example. https://github.com/googleads/google-ads-php/blob/main/examples/ErrorHandling/HandleKeywordPolicyViolations.php

They say the error will be thrown in GoogleAdsException and it can be handled with the googleAdsException object. But I always get the error in ApiException.

Can anyone help me? Thank you in advance.

I have a dbt project and I'm using ad_reporting model. all the sources are working good, except than google_ads. and that's because I don't have google_ads schema, instead I have google_ads_us schema. I tried to change it in main dbt_project.yml file:

vars:     google_ads_schema: google_ads_us 

but still when I'm running this command:

dbt run --select ad_reporting 

I keep get this error:

Database Error in model stg_google_ads (models\stg_google_ads.sql) SQL compilation error: Object 'DATABASE.HISTORY_GOOGLE_ADS.GOOGLE_ADS__URL_AD_ADAPTER' does not exist or not  authorized. compiled SQL at target\run\ad_reporting\models\stg_google_ads.sql 

the HISTORY_ prefix is from profiles.yml file (SCHEMA).

Anyone know where else I need to change the schema?

Migrating from AdWords to GoogleAds api.

Querying search_term_view:

val googleAdsClient: GoogleAdsClient = GoogleAdsClient.newBuilder()   .setCredentials(credential)   .setDeveloperToken(developerToken)   .setLoginCustomerId(loginCustomerId.toLong)   .build()     val svc = googleAdsClient.getLatestVersion.createGoogleAdsServiceClient() val query = s"""   SELECT      segments.keyword.info.text     ,search_term_view.search_term     ,segments.date   FROM search_term_view   WHERE segments.date BETWEEN '2022-01-01' AND '2022-01-01' """ svc.search(customerId, query).iteratePages().asScala.foreach { page =>   page.iterateAll().asScala.foreach { row =>     //row processing   } } 

The issue is that svc.search() skips rows, if one of columns is null. So getting results like

text1,term1 text2,term2 

While same request to Adwords api returns results like

text1,term1 text2,term2 --,term3 

Haven't found anything about nulls ignoring in docs.

Using latest google ads v10 lib: "com.google.api-ads" % "google-ads" % "17.0.1"

I get the error :

{   "message": "The caller does not have permission",   "code": 7,   "status": "PERMISSION_DENIED",   "details": [     {       "@type": "type.googleapis.com\/google.ads.googleads.v10.errors.GoogleAdsFailure",       "errors": [         {           "errorCode": {             "authorizationError": "USER_PERMISSION_DENIED"           },           "message": "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https:\/\/developers.google.com\/google-ads\/api\/docs\/concepts\/call-structure#cid"         }       ],       "requestId": "asds33ad3sdadad334"     }   ] } 

and the code I get from here : https://developers.google.com/google-ads/api/docs/reporting/example

what I need to do with login-customer-id ?