📜 ⬆️ ⬇️

Auto-update of stock deadline in Yandex.Direct

In front of me and my acquaintances, there was more than once a task to update the dates daily in Yandex.Direct ads. In the ad is written "Have time to May 21", if today is May 20. And so every day is exposed the next day. For some reason, they all did it manually, although the task is perfectly and conveniently automated using the API provided by this service.

I have automated this task and want to share it with an already prepared script . In addition, it will serve as an example for work in such situations, it is easy to adapt it for other similar tasks.

The script was written under the campaign of my partner, for others it may need some changes. It was important for me to simplify the work with the script, so the option “I will upload the templates of all ads to the server and I will update every day” didn’t work - so when changing or adding ads, they had to be configured on the server.

As a result, I came to the conclusion that it is better to automatically search for the deadline in the ad and correct it to the correct one.
')
The principle of the script is as follows:


To get started with the API, you need to:

Next, download all the files from the archive with the certificate to the directory with the script on the server.

The following parameters should be entered into the script (in the first two lines):


Next, add a call to this script in cron at night, from 0 to 9 o'clock (9:00 - moderation start time) It remains only to receive notifications of the past moderations in the morning.

Yandex.Direct API documentation: http://api.yandex.ru/direct/
The script itself: https://github.com/gepo/ecommerce-tools

Source: https://habr.com/ru/post/144574/


All Articles