Automating Amazon Ads Reporting using Python and the Amazon Ads API
Reporting is great. Tools like PowerBI and Tableau make it easy to build interactive reports that can be shared within the organization as self-service data tools.
However, the challenge is to get the right data in the right format in an automated way.
Big platforms like Amazon and Facebook often offer free API access to get data on things like campaign performance. This enables developers to write scripts that regularly and automatically download the data necessary for reporting.
I’ve worked with Facebook Ads and Google Cloud services before. However, sometimes the API docs are outdated (e.g., Python 2 instead of 3), sometimes I am out of my scope of experience. Sometimes there are no useful code examples that you can just adapt to your needs.
This is what happened to me last weekend.
I wanted to automate the creation and downloading of reporting data on Amazon Sponsored Product Ads. The API doc got me started but I found no Python example and had to go through quite some trial-and-error, reading what the nice people at Stackoverflow suggested, adapting it to my needs, being creative.
Now that everything works as I wished I decided to share the code examples together with a short guide with you, so you don’t have to go through it all like I had.
You can find the latest version of my scripts on GitHub.
Getting started: What you need
Before you download and adapt my script you need to register and request a free API token from Amazon.
The Amazon Ads API enables you to manage the Advertising resources associated with an Amazon Advertiser using a REST API. […] To use the Amazon Ads API, you must first complete the onboarding process. The onboarding process has several steps, and may take several days to complete.
The onboarding process with its five steps is explained in detail in their doc: https://advertising.amazon.com/API/docs/en-us/setting-up/overview