ratelimit.png
Ë
Jeff Dwyer By Jeff Dwyer • February 22, 2017

How to Save Money on Event Tracking

Why is MixPanel so expensive?

MixPanel, Amplitude, Localytics & Kissmetrics are all expensive at scale

Paying per event is expensive when you have a bunch of events. That's just the way it is. Yes, there's a ton of variation between the pricing schemes of the big players in the event analytics space, but at the end of the day they can all become quite costly at scale. So what is a developer to do?

Save Money with One Weird Trick... Sending fewer events!

I know I know, the whole point of these systems is to collect events, but now I'm telling yout that you need to be super rigorous about what events you send and judiciously weight the cost/benefit of each new event?  Good news for you is that that's not at all what I'm suggesting. You should send events for everything: viewing pages, opening modals, closing modals, clicking buttons, experiment exposures, everything. But here's the one thing I'd point out, do you really need to send every event?  Maybe you do sometimes, but in 99% of the analysis I've done I've been looking at either:

  • How many people did X? (day by day or hour by hour)
  • How many people did X followed by Y? (where Y happens after X and is a conversion of some sort)

It turns out that to get accurate numbers for those two questions it's absolutely reasonable to only send events X & Y once per hour per user. (Did I mention that MixPanel and Amplitude can only graph these things at hourly resolution, so anything more than that is almost totally useless?) Here's an example just to be super clear:

8:01 View page X: Fire event
8:02 View page X: Dont care (and MixPanel doesn't really either)
8:03 View page X: Dont care
8:04 View page X: Dont care
8:05 View page X: Dont care
9:02 View page X: Fire Event

That's a 66% reduction in the number of events we've sent from the naive approach. Nice! And say, is there any way to make my "Activation" event fire only once per user? The MixPanel people tell me I should really define an activation event and only fire that once, but how am I supposed to know whether I've already fired it? Well don't worry, we've got you covered there too.

A RateLimit solution

For the simple hourly rate you can absolutely store a quick expiring mark for each user/event combo in memcached. For the Activation event, Memcached isn't a good fit because you want it to persist for a long time. If you want to hit the easy button, RateLim.it was born to solve this problem efficiently and at scale.

 

So wait, how much money can I save? 

I put together a really basic calculator at https://www.ratelim.it/pricing that might help. tl;dr you should save a bunch. RateLim.it is $.000005 per limit check which is practically infintesimal (1/20th of a call to MixPanel). What's better than that? RateLim.it also returns expirations headers and our client library will help you cache what time the expiry can be expected so you won't even call RateLim.it (and thus incur the $.000005) until the expiry has actually come to pass. Overall, if

your event service charges you $99 per 1M points

you do 20M points/month

ratelimiting can save you 50% of your events.

You save $1000 for the price of $100, a net savings of $900 / month. Easy peasy!

Give it a try!