googleads / google-ads-dotnet Goto Github PK
View Code? Open in Web Editor NEWThis project hosts the .NET client library for the Google Ads API.
Home Page: https://developers.google.com/google-ads/api
License: Apache License 2.0
This project hosts the .NET client library for the Google Ads API.
Home Page: https://developers.google.com/google-ads/api
License: Apache License 2.0
Hello,
Disclaimer: I am not sure whether this behavior is because of the client library or the API itself.
The problem, in short, is that the API does not return any relevant data. I get a vague ArgumentNullException every time.
This is an existing project using the old AdWords API and this would be the first new feature to use the new Ads API. They share the same configuration.
Upon further investigating and debugging the library code, I get that the client status is the following, and the response is null:
'Status(StatusCode=InvalidArgument, Detail="Request contains an invalid argument.")'
I could not find any data on which argument is invalid. I have tried several queries, but even a basic campaign enumeration does not work:
SELECT
campaign.id,
campaign.name,
campaign.network_settings.target_content_network
FROM campaign
ORDER BY campaign.id
Prior to the Ads API being enabled, I got the same ArgumentNullException, but the client status told me that the Ads API needs to be enabled and even provided a link where I could do that.
Connected TV device stats are not working in the latest release. When I query by device, I don't get a connected TV result back, but the Desktop result appears to be the sum of Desktop and Connected TV.
This will make sure we don't have one exception type per API version.
Hi,
In the documentation, Campaigns can be queried for Tracking Settings.
I see that in the stubs, there's a line referencing them, but it looks like the Campaign object I get back in the GoogleAdsRow (Google.Ads.GoogleAds.V0.Resources.Campaign) does not have Tracking Settings in it.
Is there a different place to get those values in the response row?
Best,
Kevin
Right now, grpc.max_receive_message_length defaults to 4MB, which is too small for some report requests, leading to RESOURCE_EXHAUSTED errors. Increase this limit to 64MB so that wider report rows work fine.
Right now, channels are not cached; a new channel is created every time a service is created. This slows down new service creation. Adding caching support so the performance improves.
Unable to create Sitelink. I receive the following error: Google Error: Status(StatusCode=InvalidArgument, Detail="Request contains an invalid argument.")
I'm also unable to set the FinalUrl with creating a SiteLinkFeedItem. As you can see from the code below set is not available.
public RepeatedField FinalUrls { get; }
Please attached for more detail
It currently says "ServerUrl", should be GoogleAds.Server
In the library classes, only the exceptions do expose requestId (Well, I checked CustomerService and GoogleAdsService, but I assume this is for other classes also the case). I am pretty sure requestId is also available for calls that did NOT result in an Exception.
Still we want to learn it, log it, and use it to communicate with Ads API when we have questions about a result. Further we may need few similar attributes, like server response time and operation count.
LongRunningOperations don't work, because we are not setting credentials to the underlying service instances.
The timeouts that are used by the client library are pretty short compared to the server settings. As a result, users get DEADLINE_EXCEEDED for medium to large size Search() requests and mutate requests. Update the stubs so that the client-side timeouts align better with the server-side timeouts.
Related: #97
One of the first apps I write is a simple report viewer: a Windows Forms application allowing the user to set up a report, has a button Go and a GridView showing the results. Once succeeded it proves very helpful by allowing you to test combinations of fields, to see which values can occur in the response etc.etc.
Unfortunately the result of googleAdsService.Search() contains all possible fields, which are hundreds. Can a list of fields be published too?
Note: you would think parsing the query text should reveal the names. Unfortunately the query text uses different names than the resulting report, also see issue #12
I have created a net core console app that uses the client and successfully retrieves data. However, when I add a net core web api project and call the same logic, all queries time out and return a "TRANSIENT_FAILURE" message. This only happens if I run the web API and make http calls into it -- running the console app still works.
I have a manager account and I stumbled on this old c# example.
https://stackoverflow.com/questions/13832008/google-adwords-api-c-sharp-client-library
Is this still possible in the current API? If so, could you add an updated example please.
PartialFailures appear in the Details log as a binary encoded string instead of plaintext.
Creating a new Campaign object can give very different results depending on the order of setting properties.
For example:
new Google.Ads.GoogleAds.V0.Resources.Campaign {
ManualCpm = null, // null is the default value, so this line is not needed
ManualCpc = new Google.Ads.GoogleAds.V0.Common.ManualCpc
{
EnhancedCpcEnabled = false
}
}
This creates a Campaign object with CampaignBiddingStrategyCase == ManualCpc
.
But
new Google.Ads.GoogleAds.V0.Resources.Campaign {
ManualCpc = new Google.Ads.GoogleAds.V0.Common.ManualCpc
{
EnhancedCpcEnabled = false
},
ManualCpm = null
}
This creates a Campaign object with CampaignBiddingStrategyCase == None
and ManualCpc == null
.
I understand that you only need to set one bidding strategy, but setting a property with a default value of null
to null
should not change other properties of the object in my opinion.
It took me a while to find this issue and I think it should be prevented.
I have previously been using the googleads-dotnet-lib library to make calls to google ads without issue. After switching to a new dotnet core project I use my previous credentials set up for the googleads-dotnet-lib library the google-ads-dotnet library throws the following error.
'Google.Ads.GoogleAds.V1.Errors.GoogleAdsException; in System.Private.CoreLib.dll ("Status (StatusCode=PermissionDenied, Detail="Google Ads API has not been used in the project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/googleads.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate tor our systems and retry.")")
I omitted the project number in the above however when I try to visit that page it errors out. Also when I try to add the library to my project in the developer's console I get the following error on the page "API solution not found with service name: googleads.googleapis.com".
Can I not use my OAuth credentials from the previous library and how do I get this setup in this case?
I have been having an extreme delay with the internal parsing of requests to the API. I don't think it is necessarily the time it takes the route to process the query but I am unsure. It is taking 1 - 2 minutes for a request to go out and then to be internally parsed by the library before writing to console. The googleads-dotnet library, however, is almost instant with the same query. Is this normal behavior for this library or is this just a symptom of something on my end? I have listed a code example of an example request that takes this long below.
Seems like Google.Ads.GoogleAds.Services.V0.MediaFileService is missing in v.0.7.0 ?
There is a bug/issue in the .NET client for the new Ads API beta: ConfigBase.cs, LoadConfigRoot(IConfigurationRoot configurationRoot) method, line 57:
setting => setting.Value.ToString());
The problem is that setting.Value can for some config files be null, which is not handled correctly. Example - JSON configs with hierarchy, where a section name creates an entry in the config file, but it doesn't have a value.
Hi, I am fetching campaign level data using google ads api. What value of date range should I set so that I can get the "ALL_TIME" campaign data.
Kindly help
Right now, grpc.max_metadata_size is set to 4 KB, so if a large enough exception happens (e.g. big request, multiple errors on most of the uploaded operations), then the details cannot be retrieved since the client library throws a RESOURCE_EXHAUSTED error instead. Increase the metadata size limit so that the library can correctly receive and decode these exceptions.
Current GoogleAdsConfig implementation is tied to ConfigurationManager, which is only used by .NET Framework for desktop programs. .NET Web applications, and specifically .NET Core applications use WebConfigurationManager which the current implementation of GoogleAdsConfig ignores, and so it doesn't pick up configuration from it. It's not a big deal because there is LoadConfigRoot(IConfigurationRoot configurationRoot) mentioned above, which allows loading configuration from anywhere - but it requires a bit of custom coding. Perhaps having a public constructor which takes a Dictionary or similar would be nice for cases when IConfiguration is not available.
"Could not load file or assembly 'Google.Apis.Auth, Version=1.21.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified."
Every time I call client.GetService function, I experience the above error. Then after resolving taht dependency problem, another one will pop up and then there goes the chain of dependency problem/inconsistency.
See googleads/googleads-dotnet-lib#197 for additional context. tl;dr; the callback port is random, so it cannot be added to the Google Client project as a valid redirect uri beforehand.
I have just tried GetAdGroups and GetCampaigns examples. Neither of which work. I have the correct credentials, customer id and campaign or adgroup id.
The searchPagedResponse returns nothing for each. Can you please test @AnashOommen ... Really appreciate the examples you have done, but it's very frustrating when you spend a day setting up the project in .Net Core and then find the examples don't actually work.
I am setting up the config manually if that makes any difference? It shouldn't as some examples do work.
var adsConfig = new GoogleAdsConfig()
{
DeveloperToken = googleAdsApiSettings.DeveloperToken,
OAuth2Mode = googleAdsApiSettings.OAuth2Mode,
OAuth2ClientId = googleAdsApiSettings.OAuth2ClientId,
OAuth2ClientSecret = googleAdsApiSettings.OAuth2ClientSecret,
OAuth2RefreshToken = googleAdsApiSettings.OAuth2RefreshToken
};
Hi Team,
I am trying to fetch customer information using google adwords api version v201809 in C# .NET
But sometimes I get the following error
" The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'OAuth realm="https://accounts.google.com/OAuthGetRequestToken"'. [Returned while handling POST Request"
What is the root cause of this error. Please help me with this.
I'm calling the MutateCampaignBudgetsAsync
method. From my test machine it works fine but from another server it throws a GoogleAdsException with the message: Status(StatusCode=Internal, Detail="Failed to deserialize response message.")
.
I assume it might be a dll version problem or something but the error message is not helpful.
I've tried somethings, even turned on verbose logging for Grpc but that did not return anything helpful.
How can I find out what data is not being deserialized and why?
Thanks.
I started getting an exception thrown from the LoggingInterceptor when I upgraded from 2.0 to 2.2. I think it might be related to this change made in 2.1:
- Made a change to generate logs only if appropriate logging levels are set.
To generate the logs, I had set:
TraceUtilities.Configure(TraceUtilities.DETAILED_REQUEST_LOGS_SOURCE, listener, SourceLevels.All);
TraceUtilities.Configure(TraceUtilities.SUMMARY_REQUEST_LOGS_SOURCE, listener, SourceLevels.All);
Is anyone else having this issue?
Reproduction: Modify example GetKeyworkStats.cs, modify one of the select-fields (I changed "campaign.id" to "campaign.id__". You get a GoogleAdsException.
This exception has no reference to the original network exception, at least its InnerException member is null.
Note I used them to communicate with AdWords API Support to give more insights in the background. AdWords API used to pass the inner HttpWebException, and we passed its Response headers to AdWords API Support. Those headers contained extra information like the actual server name that generated the response.
However, if such information is not at all usable for support this issue can be closed.
Hi Team,
We are managing our clients google ads account using our Manager account (527-708-3201). When our client to connect to our Manager account using our mobile app (adwords API) I am getting the following error.
Failed to exchange authorization code for access token.
Kindly tell me what is the reason behind this error. How can I resolve this.
Scenario:
The returned error is:
Exception thrown: 'Google.Ads.GoogleAds.Lib.GoogleAdsException' in Google.Api.Gax.Grpc.dll
Failure:
Message: Status(StatusCode=Unavailable, Detail="Getting metadata from plugin failed with error: Exception occurred in metadata credentials plugin.")
Failure:
Request ID:
SearchAsync doesn't have a GetAwaiter method so you can't use await making the call run synchronously
I am using Google ads api .net client in my project. I get grpc_csharp_ext.x64.dll not found.
Hi @AnashOommen ,
I am writing a query in Google ads query language to fetch Account performance report. I want to add a condition in where clause where I want to fetch the records where advertising_channel_sub_type not in "SEARCH_EXPRESS", "DISPLAY_EXPRESS".
So I wrote the following query
SELECT campaign.advertising_channel_sub_type,
campaign.advertising_channel_type,
segments.device,segments.date,
metrics.impressions, metrics.clicks,
metrics.ctr, metrics.average_cpc, metrics.cost_micros,
metrics.interactions,
metrics.average_cpm,
metrics.conversions,
metrics.cost_per_conversion,
metrics.search_budget_lost_impression_share,
metrics.search_rank_lost_impression_share,
metrics.search_impression_share,
metrics.all_conversions,
metrics.all_conversions_value,
metrics.conversions_value
FROM campaign WHERE segments.date BETWEEN '2000-01-01' AND'2019-04-11'
AND campaign.advertising_channel_type NOT IN ('SEARCH_EXPRESS','DISPLAY_EXPRESS')
But I got the following error.
{"Status(StatusCode=InvalidArgument, Detail="Request contains an invalid argument.")"}
{{ "errorCode": { "queryError": "BAD_ENUM_CONSTANT" }, "message": "Invalid enum valuess cannot be included in WHERE clause: 'SEARCH_EXPRESS', 'DISPLAY_EXPRESS'." }}
Please recommend me how can I add the condition in my report.
Provide users with a way to override call settings on a per-service level. Right now, this is exposed on a per-call basis only. While that's more granular, it is also a lot of boilerplate code for users. Exposing call settings at service level tries to strike a balance between usability and granularity.
Your examples use an app.config. Is there an example using appSettings.json?
The endpoint Service.ListAccessibleCustomersAsync(request) under the CustomerServiceClient service will only return the manager customer id as a response instead of the customer id's that the manager has access to. Any insight would be greatly appreciated, thanks as always.
Right now, the timeout settings in generated stubs are not honored by the client library. Update the factory construction code so that these settings are honored.
Hi Team,
We are managing our clients google ads account using our Manager account (527-708-3201). We have two step verification enabled in our account. However, when our client to connect to our Manager account using our mobile app, the client get the following error message.
Message: AdWordsApiException: Exception of type 'Google.Api.Ads.AdWords.Lib.AdWordsApiException' was thrown. The customer has a policy to enforce 2-Step Verification, but the user is not enrolled.. (Error: AuthorizationError.TWO_STEP_VERIFICATION_NOT_ENROLLED
What we need to do in this scenario.
See googleads/googleads-dotnet-lib#191 for broader issue.
I am running the GetCampaign.cs file in google ads examples project but I am getting the following error.
StatusCode": 14,
"Details": "Name resolution failure",
"RequestId": null
Customer Id="5826317268"
The most hated 'feature' in previous AdWords API was the inconsistency in field names in reports. For instance, if you request field CreativeQualityScore then the resulting report would have a field named adRelevance.
This sounds like a one-time nuisance, but when the API version got upgraded, and the upgrade docs stated for instance that CpcBid may now give a "--" result, then you had to go through your sources to look for maxCPC. And if a field was discontinued, you had to look in OLDER documentation what its result name would be. And so on.
Unfortunately Ads API seems to have the same problem. You ask for ad_group.name, and you get AdGroup.Name. Can't we use the exact same names? And also the same usage of uppercase and lowercase.
Note: Maybe it's not a problem in the library, but a problem in the API. In that case, can this bug be passed on?
These all seem to be new services from v0_5 and v0_6.
Hi Team,
I am trying to link to google adwords account using Oauth2 in C# .net . However, I am getting the following error,
MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'OAuth realm="https://accounts.google.com/OAuthGetRequestToken"'. [Returned while handling POST Request]
I had a communication regarding this with the google adwords support team. They had following reply for this
It looks like the issue is specific to the client library that you're using. Could you please post your concern on the Github issue tracker so the library owners can assist you on this
Kindly suggest what can I do to resolve the exception
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.