GithubHelp home page GithubHelp logo

googleads / google-ads-dotnet Goto Github PK

View Code? Open in Web Editor NEW
71.0 71.0 96.0 51.84 MB

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

Shell 0.03% C# 99.96% HTML 0.01% CSS 0.01% JavaScript 0.01% ASP.NET 0.01%

google-ads-dotnet's People

Contributors

anashoommen avatar andrewmburke avatar aukevin avatar coryliseno avatar danielfrg avatar dependabot[bot] avatar dwardin avatar friedenberg avatar johnjameswhitman avatar johnpisg avatar jradcliff avatar laurachevalier4 avatar pierrickvoulet avatar rafaumlemos avatar raibaz avatar stevenberger avatar wfansh avatar wub avatar yangda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-ads-dotnet's Issues

InvalidArgument error

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.

Increase the grpc.max_receive_message_length to 64MB

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.

Cache channels for services...

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.

Google Ads API V1 Sitelink

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

SiteLinkIssue.docx

requestId is only available when an exception occurs

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.

LROs don't work as expected

LongRunningOperations don't work, because we are not setting credentials to the underlying service instances.

Align the timeouts in generated stubs to the server settings...

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

Can reports show the field names in the result?

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

Client not working in Net Core Web API context

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.

Unexpected results with Campaign object creation

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.

Authentication Issues

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?

Response Times

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.

LoadConfigRoot doesn't handle config entries with null values

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.

Increase grpc.max_metadata_size to 16MB

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.

GoogleAdsConfig implementation is too tied to ConfigurationManager

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.

client.GetService(Services.V1.KeywordPlanIdeaService)

"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.

GetAdGroups and GetCampaigns Examples Not Working?

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
        };

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

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.

Internal Exception not helpful

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.

Exception Thrown in Google.Ads.GoogleAds.Logging.LoggingInterceptor (2.2)

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?

GoogleAdsException has no InnerException with the original exception

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.

Failed to exchange authorization code for access token

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.

Unclear error message when OAuth credentials are invalid

Scenario:

  • Installing googleads library via NuGet as a new console project
  • Web flow OAuth client_id and client_secret are used
  • Refresh token is invalid
  • all other necessary config details are given to the library

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: 

GoogleAdsServiceClient

SearchAsync doesn't have a GetAwaiter method so you can't use await making the call run synchronously

BAD_ENUM_CONSTANT Google ads Query language error

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

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.

Can't Grab Managed Customers

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.

AuthorizationError.TWO_STEP_VERIFICATION_NOT_ENROLLED

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.

Consistent field names in reports

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?

MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.