After seeing this post on r/ruby about importing your Amazon order history into SQLite, I thought: I kind of want to know how much I’ve spent on Amazon…but not enough to write a program tonight. While I didn’t find an API for order history, Amazon has a convenient order history report-building tool (login required) that can generate a CSV of every Amazon item you’ve shipped in the past 10 years.
Here’s what the order form looks like:
The form lets you select a date at the beginning of 2006, but the earliest order in my history was in late July 2006, i.e. 10 years ago from today. I used the web inspector to tamper with the form’s POST request but still didn’t receive any data before July 2006 (according to my old GMails, I’ve ordered at least one Simpsons DVD set pre-2006).
Another limitation of this data: again, the Order History Form only includes physically shipped items. So it doesn’t include digital purchases, such as streaming movies and Kindle books.
According to the report I downloaded, since 2006, I’ve ordered roughly 300 different physical items from Amazon. Some items were purchased in quantities greater than 1, but Amazon records a row for every item per order. For example, my dataset includes several entries for this Macbook keyboard cover.
I’m pretty surprised at how low that total number of different items is. I would’ve guessed that I’ve made at least 300 separate orders – each order containing multiple kinds of items – but I’ve actually made 160 orders. I’ve been a long-time Amazon Prime customer partly because I had thought I ordered from Amazon so often, but the data seems to tell a different story.
(note: I order Kindle books frequently, so that’s probably why I think I’ve ordered much more than what my physical order history shows)
- The earliest thing in my order report is a $13.90 copy of Jagged Alliance 2. No surprise there, that game is the best.
- Most expensive thing I’ve paid for is this $599.00 camera adapter to attach Canon lenses to my Sony cameras.
- I stopped buying DVDs for myself after 2007, which is when I joined Netflix. Though I did purchase the complete set for The Wire in 2011 and a copy of Idiocracy in 2009, as neither were then available for streaming.
Using a pivot table, this is the top 3 categories by number of items and price paid:
Ouch. Though not surprising…the “Personal Computers” category also consists of hard drives and memory cards, and “Electronics” includes digital cameras and accessories. So that seems about right for 10 years of memory capacity, laptops, monitors, and camera equipment, not including what I’ve spent at the Apple Store.
If you’re curious about the kind of data the report contains, here are the headers and the values for a sample order. The ASIN/ISBN field contains the unique ID that you can append to
http://www.amazon.com/gp/product/ in order to get the product page URL:
|List Price Per Unit||14.98|
|Purchase Price Per Unit||8.99|
|Payment - Last 4 Digits||9999|
|Purchase Order Number|
|Ordering Customer Emailemail@example.com|
|Shipping Address Name||Dan Haus|
|Shipping Address Street 1||100 Broadway|
|Shipping Address Street 2|
|Shipping Address City||NEW YORK|
|Shipping Address State||NY|
|Shipping Address Zip||10006-3734|
|Carrier Name & Tracking Number|
|Item Subtotal Tax||0.80|
|Tax Exemption Applied|
|Tax Exemption Type|
|Buyer Name||DAN HAUS|
|External Item Number|
Here’s the Create an Order History Report page: https://www.amazon.com/gp/b2b/reports
Here’s a help page about how to use that page.