Notes on a price markup detector

"Nobody makes a price $11.08 - this is a lazy markup!" When you see a whole page of prices like this, you know the prices are marked up, usually by a fixed percentage. 

Percentage markups happen often with mobile food delivery services, but they've started to creep into some online shops and other online goods too - anyone with a middleman who takes a percentage fee, or anyone trying to adjust things gradually with the recent, crazy inflation.

What if we could use math to see this? It turns out "nice prices" are pretty rare mathematically, so there is a way. After messing with this for a while, a simple Chrome extension was born. 

You can try it here, and I did all the privacy stuff right so it won't track you or anything. (The code only runs when you click it.)

This extension brute-forces a whole lot of markups and tries to figure out which markups would map to a large number of "nice" prices like $4.99. It turns out that once you have a few, different marked-up prices on the same page (like you might find on a menu or a website), the statistics from "just guessing and looking for nice prices" works out pretty well, and you can "undo" the markup pretty easily. 

Which percentage to use? Well, every one you can think of, brute-force, because computers are fast. If you had to do this on a spreadsheet it would take a few minutes, which was satisfying at first, but a bit too much work to do more than a few times.

I tried three methods, and the extension uses two of them: 

  1. First, just try all the integer percentages (e.g., divide by 1.20), but this misses a lot of things, because it turns out the vendors try to "undo" the referral fees charged by the platforms. 
  2. Once realizing this, you can get most of the rest also looking at the inverses of all the integers. So, undoing Apple's popular App Store markup means you divide by (1.0/0.7 = 1.4286...) There are some rounding details too, but the simple algorithm works reasonably well.
  3. The third method (and most complete) is to generate all the "nice" prices less than the current one and look for collisions with these and the resulting percentages - very brute force. This suffers from some false collisions, and you have to be extra careful with rounding to make them resolve. But this method had a few too many numerical/rounding issues and so I did not use it in the end. Basically the trouble here, as you divide by smaller and smaller numbers, is that they tend to clump up and create false signals, so you have to be very careful to get bucket sizes right.
Of course, not all markups are a simple percentage. It's becoming popular to just mark up prices by a dollar or whatever for online orders, and this would take indexing of the whole web to figure out. But for the simple, lazy ones, this tool should help you see around the markups.

And anyway, the math was fun.

No comments:

Post a Comment