Posts under category Google

I've seen a slide which advises to cache with a dictionary. In which case we can even get the same budget twice? What does it save?

The API docs state that:

getBudget() Returns the budget of the campaign. In order to change the campaign's budget,  

We are using the Google Ads transfer in BigQuery to ingest our Google Ads data. One thing I have noticed when querying the results is that all of the metrics are exactly 156x of the values we would expect in the Google Ads UI (cost, clicks, etc.)

We have tested multiple transfers and each time we have this same issue. The transfer process seems pretty straight forward, but am I missing something? Has anyone else noticed a similar issue or have any ideas of what to look at to adjust in the data transfer?

I'm trying to create a campaign that must target mobile devices only, using the google ads API client library in python. The documentation says that I have to modify the DeviceInfo criteria, but that attribute is immutable. This is my code rn:

campaign_service = client.get_service("CampaignService")     campaign_criterion_service = client.get_service("CampaignCriterionService")     # Create the campaign criterion.     campaign_criterion_operation = client.get_type("CampaignCriterionOperation")     campaign_criterion = campaign_criterion_operation.create     campaign_criterion.campaign = campaign_service.campaign_path(         customer_id, campaign_id     )          campaign_criterion.device = client.enums.DeviceEnum.MOBILE 

What am I missing?

I have a project whose Publishing status is Testing (I am using Google Ads Api).

            using FileStream stream = new("Credentials.json", FileMode.Open, FileAccess.Read);             // The file token.json stores the user's access and refresh tokens, and is created             // automatically when the authorization flow completes for the first time.             UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(              GoogleClientSecrets.FromStream(stream).Secrets,              scopes,              "user",              CancellationToken.None,              new FileDataStore("Token", true)             );             if (credential.Token.IsExpired(credential.Flow.Clock))                 await credential.RefreshTokenAsync(CancellationToken.None); 

When I use the code above, it expects me to log in via Gmail, but I want to automatically handle the Refresh token and continue uninterrupted requests without understanding anything to the user. I am using Desktop Application as Flow, but I am using Net 5 Api as Framework. I look forward to your help in this matter.

Thank you from now.

I need to use Python in Google Colab to dismiss recommendations from many managed Google Ads accounts using the Google Ads API. I have been using the docs and the GitHub examples to build my code and it has worked to an extent. I have been able to retrieve recommendations with their resource names, but I have not been able to dismiss the recommendations. It seems there is an error getting the DismissRecommendationOperation.

Here is the code (with sensitive info redacted) and error message:

client = GoogleAdsClient.load_from_storage("google-ads.yaml.txt", version="v10") customer_id = "XXXXXXXXXX" recommendation_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" rec_service = client.get_service("RecommendationService") operation = client.get_type("DismissRecommendationOperation") operation.resource_name = recommendation_service.recommendation_path(     customer_id, recommendation_id ) response = rec_service.dismiss_recommendation(     customer_id=customer_id, operations=[operation] ) print(     "Dismissed recommendation with resource name: "     f"'{response.results[0].resource_name}'." ) 
--------------------------------------------------------------------------- AttributeError                            Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/google/ads/googleads/client.py in get_type(self, name, version)     440             type_classes = self._get_api_services_by_version(version) --> 441             message_class = getattr(type_classes, name)     442         except AttributeError: 2 frames AttributeError: unknown type 'DismissRecommendationOperation'. During handling of the above exception, another exception occurred: ValueError                                Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/google/ads/googleads/client.py in get_type(self, name, version)     442         except AttributeError:     443             raise ValueError( --> 444                 f"Specified type '{name}' does not exist in "     445                 f"Google Ads API {version}"     446             ) ValueError: Specified type 'DismissRecommendationOperation' does not exist in Google Ads API v10 

I have been using the docs here: https://developers.google.com/google-ads/api/docs/recommendations and the GitHub example here: https://github.com/googleads/google-ads-python/blob/23b6342914b49fa50e1c82b67f6508d2ac721787/examples/recommendations/dismiss_recommendation.py

Thank you so much for your help!