Closed miguelem closed 2 years ago
@miguelem your description is pretty much what I would recommend, given the application you describe. You could assemble a single script that makes a query to the API, filters the results based on a specific criteria (i.e. ads with fewer than 100 clicks in the past X days), then takes an action on those Ads afterwards in a mutate request. You could look into ways to run this script periodically in a cron job - there are numerous approaches for this.
It seems like this would probably be a better application for Scripts, but I get the sense that this might be a learning tool for you, in which case, in addition to the above script, you might also try building a front-end where you can change the criteria that dictates whether an ad should be paused.
Feel free to post new issues if you have any further questions!
Thanks @BenRKarl. I was looking more for code examples or detailed guides than generic advice, but it's good to know that I'm on the right track.
@miguelem Ah I see, well if you haven't already definitely take a look at the code examples in this repository.
Also a colleague put together a demo app that you might fine useful, take a look at the frontend and backend repos.
@BenRKarl I checked the code examples and the "Fran Ads" demo app.
As far as I know, there are zero examples for automation. That's why I asked....
Any examples, tutorials or tips to use the API (with Python) to automate changes based on certain conditions?
For example: Pause all ads that have less than 100 clicks in the last year.
This kind of automation is a very common use case. And there are a lot of Google Ads Scripts for these automations (e.g. https://groups.google.com/g/adwords-scripts/c/0wTLmPmxIQY), but I haven't found any examples to do it with the API.
I guess it will require something similar to the get_responsive_search_ads.py example to get all the ads that fill the conditions required and then use something similar to pause_ad.py to pause the ads.
But I guess you need some kind of loop/iterator to go through all the elements (in my example, pause all the ads that fill the conditions), so the code from pause_ad.py would have to be changed a lot (because that code seems to be only for a single ad).
Is that the best solution? Or are there easier or more efficient ways to do this?
Any docs or code examples that I can check about this?
I've managed to get the client library examples working separately, but I'm struggling to bring all the pieces together to make something that is really useful.
Thanks!