.Net Lib GoogleAd API not working

331 views
Skip to first unread message

Pravin Chetu

unread,
Oct 4, 2019, 9:03:30 AM10/4/19
to AdWords API and Google Ads API Forum
Hi Team,

after downloading and then setup code it is not working and giving error on JSON key parsing.
https://github.com/googleads/googleads-dotnet-lib

we want to have wsdl or JSON based API to get googleAd details. like clicks, users, QL etc. it will be good if got a working sample.

we want to use The AdWords Query Language (AWQL). so it will be good if we got a working copy link.

in future we will also create AdCopy and bid from our application. 

Note: we will be accessing Adword API from our c# service code.

Google Ads API Forum Advisor Prod

unread,
Oct 4, 2019, 3:03:48 PM10/4/19
to esc...@gmail.com, adwor...@googlegroups.com

Hi Pravin,

I am from Google Ads API Team. To confirm, this link is pointing to the latest working .net client libraries to make calls against the API. Could you please make sure you are following the exact steps mentioned in the README.md file to install the client libraries on your end? If the issue persists, could you please post your concern on the github issue tracker as our client libraries team will be better equipped to assist you regarding your concern? Additionally, you might find this code samples (in C#) useful while making request calls. Let us know if you have any further questions.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UKMC5H:ref

Pravin Chetu

unread,
Oct 7, 2019, 7:54:24 AM10/7/19
to AdWords API and Google Ads API Forum
After getting the authorizationCode and exception occurs  oAuth.FetchAccessAndRefreshTokens(Request.Params["code"]); sample code below

  else if (Request.Params["state"] == "callback")
            {

                oAuth.FetchAccessAndRefreshTokens(Request.Params["code"]);
}

And detail exception coming from GoogleAPI as attached. Please help to fix the issue. 
Error.jpg

Google Ads API Forum Advisor Prod

unread,
Oct 7, 2019, 9:38:24 AM10/7/19
to esc...@gmail.com, adwor...@googlegroups.com

Hi Pravin,

The error "Failed to exchange authorization code for access token" may show up if the client ID being passed in later to get the authorization token is not the same client ID that was passed in when the refresh token was generated. Could you please verify this on your end and also, please confirm if you are authorizing (manually accepting the prompt) after logging into the correct account? Once you have the authorization code (the code which is in the format"4/*********"), you will need to exchange this to get the refresh token. Could you please confirm if you're performing this? Please give this a try and let me know if the issue persists.



Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UKMC5H:ref

Pravin Chetu

unread,
Oct 7, 2019, 11:13:01 AM10/7/19
to AdWords API and Google Ads API Forum
Please find the attached snap1, snap2 and detailed exception we already have in ticket. We are able to get the authorization code but when we are passing it then getting the error. Method not giving the refresh token.
snap2.jpg
snap1.jpg

Google Ads API Forum Advisor Prod

unread,
Oct 8, 2019, 4:34:30 PM10/8/19
to esc...@gmail.com, adwor...@googlegroups.com
Hello Pravin,

Could you please mention how you are creating the OAuth credentials? offline mode or web mode? As mentioned here the program will provide refresh token only when the offline mode is followed. Also, the user who fetched the authorization code must create the client id and secret if the users are different then the access token/refresh token may not be created. Please double check the above mentioned conditions, please let me know if you are still facing the error.

Regards,
Sai Teja, Google Ads API Team
 

ref:_00D1U1174p._5001UKMC5H:ref

Pravin Chetu

unread,
Oct 9, 2019, 10:31:43 AM10/9/19
to AdWords API and Google Ads API Forum
Hi Sai,

Can you provide the link that we can follow to use offline mode. providing the attached snap of application and service_account mode that we have tried to execute but in both case same exception occurs. setting i have highlighted in rectangles. 
snap3.jpg

Google Ads API Forum Advisor Prod

unread,
Oct 9, 2019, 11:55:08 AM10/9/19
to esc...@gmail.com, adwor...@googlegroups.com
Hello Pravin,

I see that you are using service account mode from the screenshot shared. Please follow the installed application flow as mentioned here. Also, in the step-1 of the guide while creating OAuth2 credentials follow the installed application flow. Please give it a try and let me know if you have any further questions. 

Pravin Chetu

unread,
Oct 22, 2019, 10:34:15 AM10/22/19
to AdWords API and Google Ads API Forum
Thanks for your support. we are able to get data from google Adwords, after getting developer token. but can you suggest with a link or query, so that we can get qualified Leads (QL) from adword API data. 

Google Ads API Forum Advisor Prod

unread,
Oct 22, 2019, 1:17:21 PM10/22/19
to esc...@gmail.com, adwor...@googlegroups.com
Hello Pravin,

Could you please confirm when you say qualified leads, you are looking for the performance data of the keywords, ads, and campaigns? If yes, you can download the reports mentioned here via AdWords API and a sample report program is here for your reference in Java. Code samples in other programming languages available here. Please elaborate if you are looking for something else.

Pravin Chetu

unread,
Nov 7, 2019, 7:29:18 AM11/7/19
to AdWords API and Google Ads API Forum
Hi Teja,

we have a custom column in our ad-word account.. Search Keywords->Columns->Custom columns-> <then we have column> QL.
so how we can get our custom column values using AWQL.

Google Ads API Forum Advisor Prod

unread,
Nov 7, 2019, 1:46:25 PM11/7/19
to esc...@gmail.com, adwor...@googlegroups.com

Hello Pravin,

API doesn't support custom columns, so it is not possible to fetch hr custom columns data via AdWords API reports. Please let me know if you have any other questions.

Pravin Chetu

unread,
Nov 21, 2019, 7:25:46 AM11/21/19
to AdWords API and Google Ads API Forum
Hi Sai Teja,

we are downloading the excel from google AdWords. Keywords-> Search term-> Download->.csv. So we are getting the Search Term, Campaign, Ad Group and others. Can we get search term keyword id, Campaign Id and Ad Group Id in downloaded .csv. Please provide some link or steps for getting Ids.

Google Ads API Forum Advisor Prod

unread,
Nov 21, 2019, 1:03:07 PM11/21/19
to esc...@gmail.com, adwor...@googlegroups.com
Hello Pravin,

It is not possible to have the AdGroupId in that UI view directly. However you can use the REPORTS -> Predefined reports -> Basic-> Search Terms and then add the Ad group id fields from the left panel. Which should give you the same information that you are seeing in the UI along with more detailed metrics and more fields.

Pravin Chetu

unread,
Dec 16, 2019, 12:59:20 PM12/16/19
to AdWords API and Google Ads API Forum
Hi Sai,
We are able to get custom column of qualified lead(QL)  in download excel for account's keyword. But now we want to get the date of that qualified lead. As we are able to check on portal that googleAdwords have filter of date and able to find QLs as per date range so some where google knows date of that QL.

please check the snaps for detail. both snap having two date filter and we are able to know the exact QL lead of that date range. So now we want that how we date wise count of qualified lead lead. i.e how we can get date in download or add in custom column.
snp1.jpg
snap2.jpg

Google Ads API Forum Advisor Prod

unread,
Dec 17, 2019, 9:48:58 AM12/17/19
to esc...@gmail.com, adwor...@googlegroups.com
Hi Pravin,

If you are using an AWQL report, you can specify custom date ranges using the YYYYMMDD format. Here are more details on custom date ranges. You could also include the field Date to segment your data by its date.

Regards,
Anthony

Pravin Chetu

unread,
Dec 17, 2019, 11:22:22 AM12/17/19
to AdWords API and Google Ads API Forum
In attached you have seen the custom column Qualified Lead. Can you explain how we can get that using AWQL? 
snap2.jpg
snp1.jpg

Google Ads API Forum Advisor Prod

unread,
Dec 17, 2019, 3:33:01 PM12/17/19
to esc...@gmail.com, adwor...@googlegroups.com
Hello Pravin,

As Teja mentioned, it's not possible to use custom columns in reports using the API.

Pravin Chetu

unread,
Dec 18, 2019, 6:42:49 AM12/18/19
to AdWords API and Google Ads API Forum
Still I have same question.

We are able to get custom column of qualified lead(QL)  in download excel for account's keyword. But now we want to get the date of that qualified leads ( count ) for a day. As we are able to check on portal that google Ad words have filter of date and able to find QLs as per date range, so some where google knows date of that QL.

please check the snaps for detail. both snap having two date filter and we are able to know the exact QL lead of that date range. So now we want how we get date wise count of qualified lead along with date in downloaded excel.
snap2.jpg
snp1.jpg

Google Ads API Forum Advisor Prod

unread,
Dec 18, 2019, 3:54:30 PM12/18/19
to esc...@gmail.com, adwor...@googlegroups.com
Hi Pravin,

This issue will need to be addressed by the Google Ads Product team since they would know how to get the dates of custom columns, which the API doesn't support. You can reach out to them via this link.

Pravin Chetu

unread,
Jan 22, 2020, 2:07:41 PM1/22/20
to AdWords API and Google Ads API Forum


     Query = $@"SELECT                                 
                
                                              click_view.gclid,
                                           FROM keyword_view
                                           WHERE campaign.advertising_channel_type ='SEARCH'
                       AND segments.date BETWEEN '2013-11-05'  AND '2020-01-06'
                       AND campaign.status = 'ENABLED'
                       AND ad_group.status = 'ENABLED'      
                       AND ad_group_criterion.status = 'ENABLED'             
                      ORDER BY campaign.id DESC"

how to get Keyword_view with gclid data.


Google Ads API Forum Advisor Prod

unread,
Jan 23, 2020, 9:36:01 AM1/23/20
to esc...@gmail.com, adwor...@googlegroups.com

Hello Pravin,

Thank you for reaching out. With regards to your concern, it is not possible to use click_view.gclid with the keyword_view resource via API. You could use the attributed resources listed in the shared guide along with this resource in your SELECT and WHERE clauses. Let us know if you need any additional information.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001USwv1Q:ref

Pravin Chetu

unread,
Jan 24, 2020, 6:53:12 AM1/24/20
to AdWords API and Google Ads API Forum

         Hi Team,       
         How  can we get the Keyword ID or any relation to regarding Keyword ID at using the value of   click_view.gclid 
 

Google Ads API Forum Advisor Prod

unread,
Jan 24, 2020, 2:26:54 PM1/24/20
to esc...@gmail.com, adwor...@googlegroups.com

Hello Pravin,

With AdWords API, the Click Performance Report has the field CriteriaId and CriteriaParameters that will return the criterion that triggered the impression for each GclId (based on the single attribution model) and may be of any criteria type, not just keywords. These fields are deprecated in Google Ads API Beta, you might find the migration guide useful for AdWords equivalent in Google Ads API Beta. You need to use the keyword_view resource to query all the keyword related information along with the fields from attributed resource which might be helpful to retrieve the criterion details (ad_group_criterion.criterion_id, ad_group_criterion.keyword.text etc). There are no other alternatives available to use the field click_view.gclid with the keyword_view resource via API. Let us know if you have any further concerns.



Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001USwv1Q:ref

Pravin Chetu

unread,
Jan 29, 2020, 5:36:14 AM1/29/20
to AdWords API and Google Ads API Forum
 
Hi  Nikisha 
 
  
           As per your suggestion we did not found    CriteriaId and CriteriaParameters  in  Click Performance Report(click_view) .and i also attached Click_view.png to show  that.
          Now how we get or relate with  Keword.Text  using Google click id (gclid ).
Click_view.png

Google Ads API Forum Advisor Prod

unread,
Jan 29, 2020, 3:20:09 PM1/29/20
to esc...@gmail.com, adwor...@googlegroups.com
Hi Pravin,

I will respond on behalf of my colleague Nikisha. As she mentioned in her previous post, there is unfortunately no way to do this in Google Ads API. I have submitted a feature request on your behalf so please keep an eye on our Developer Blog for information on future releases.

Regards,
Mitchell
Reply all
Reply to author
Forward
0 new messages