惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
L
LangChain Blog
Vercel News
Vercel News
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
T
Threatpost
Scott Helme
Scott Helme
T
Tailwind CSS Blog
Latest news
Latest news
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
The Register - Security
The Register - Security
罗磊的独立博客
P
Proofpoint News Feed
腾讯CDC
S
Schneier on Security
雷峰网
雷峰网
A
About on SuperTechFans
T
Tenable Blog
F
Full Disclosure
Cyberwarzone
Cyberwarzone
博客园_首页
有赞技术团队
有赞技术团队
K
Kaspersky official blog

文章列表

Compulsive curiosity, or, how I built an infinite idea machine Gift details on the subscriber portal Portal link in the archive nav First, add no friction: How micropayments lost and subscriptions won Filter subscribers and automations by source Automations, rebuilt What email will look like in the future Filter subscribers by bounce date and reason Email could have been X.400 times better Three features are moving behind the paywall Firewall changes and improvements Put your name and voice into your company newsletter Simplified email address settings Subscription wall Inboxes were overwhelming before we'd even named them The US government tried really hard to screw up email Public postmortem: database connection exhaustion Ask a nerd: what is the best way to unsubscribe from newsletters? Bookshop.org embeds Email was into agents before they were cool Passwordless login Rename metadata keys in bulk A spring cleaning for our legal docs Ask a nerd: what happens when you click the spam button? Passkey support for two-factor authentication How Buttondown's API versioning works Safer defaults for the email creation API How to send email to space How we enabled Content Security Policy for everyone Recovery codes for two-factor authentication Filter sent emails by engagement rate How we migrated to TypeIDs without breaking clients How we check every link in your email Use newsletter metadata in your emails Should we bring back email exploders? Sort and filter by open and click rates Custom click tracking domains More newsletter settings in the API Revamped replies Custom email templates for everyone Simplified cancellation Ask a Nerd: Does email length affect deliverability? The changelog, reborn Swedish localization Forwarding an email is not always straightforward Public descriptions for tags OpenAPI spec for archives How Rodrigo brings a humanistic view to consumer technology Subscribers can come from anywhere. Even another newsletter platform's form. Survey responses on the web How Brandon Lucas Green shares his music and supports artists Your newsletter's archives are more valuable than your list Better tag self-management Smarter automation filters Granular API keys New design settings pages Snippets Ask A Nerd: How does newsletter cadence affect deliverability? Starred views More ways to customize your archives Inbox filtering Mastodon follower analytics Ask a Nerd: What are good open, click, and response rates for an email newsletter? How we migrated our database to PlanetScale Two new archive themes Custom buttons now work in Markdown mode Ask a Nerd: Does attaching files to your newsletter hurt deliverability? Seline and Tinylytics support Unban subscribers Announcement bars for your archives Bang paths, source routing, and how email trips were planned Public postmortem: archive downtime 2025 disposables.app Russian localization Ask a Nerd: Can you improve email deliverability with a personal domain? More locale options How we interview customers at Buttondown Bluesky analytics Reply to conversations Minimum viable complexity How Jeffery Hicks goes behind-the-scenes in his newsletter Changes to our stack in 2025 2026: Emails TK reminders in the editor What the hell is a UTM? Randomize survey answer order Scroll sync in the editor How Jamie Thingelstad uses Buttondown to explore tech topics 2026: Archives How Kelly Jensen uses Buttondown to discuss key library issues Keeping feature creep at bay Improved filters Content Security Policy in archives Open source Sniperl.ink Auto-activating RSS reader subscriptions What the hell is ActivityPub? Gift subscriptions How Igor Ranc built Berlin's largest expat tech newsletter Template change history
Why we insourced analytics
Justin Duke · 2025-12-03 · via

In late March, we put out an innocuous changelog entry announcing that our tracking infrastructure was now our own. The body of the entry was fairly non-descript: I wanted to find a quieter time to talk about the how and why, and that time is now.


Buttondown, just like most other platforms, relies on vendors like SendGrid or Postmark to actually handle the SMTP side of sending emails. These vendors also offer link and open tracking that they manage and inject on your behalf. Some platforms use these directly; others roll their own implementation. For a long, long time (five years!) we were the former.

This decision — to rely on Mailgun or whomever for click tracking — made sense at the time, but grew more painful as time passed:

  1. We currently send outbound emails through five different vendors, and standardizing the events across all five became increasingly annoying.
  2. The performance of tracking events was suboptimal, as we had to rely on webhooks to relay the events to our own servers.
  3. The privacy posture of outsourcing this is suboptimal relative to "owning this thing end to end".

Moreover: the benefits of outsourcing this, as valid as they are early on, became increasingly diluted as we scaled: as other parts of our application matured, our ability to handle spiky traffic, detect bots, and so on became less hinterlands-shaped and more like solved problems ready for re-use.

Okay but literally how did you do it

The beautiful part about a lot of this work is that it is, from a programming perspective, fairly simple.

For instance! Here is the entire implementation of our open tracking endpoint:


from django.http import HttpResponse
from django.http.request import HttpRequest
from ipware import get_client_ip

from emails.models.asynchronous_action.model import AsynchronousAction
from emails.models.subscriber.actions import track_open


def view(request: HttpRequest, compressed_id: str) -> HttpResponse:
    ip_address = get_client_ip(request)[0]
    user_agent = request.META.get("HTTP_USER_AGENT")
    compressed_payload = track_open.compress(
        track_open.Payload(
            compressed_id=compressed_id,
            ip_address=ip_address,
            user_agent=str(user_agent),
        )
    )
    AsynchronousAction.enqueue(
        track_open.__name__,
        [compressed_payload],
    )
    return HttpResponse()

"Okay", you say. "That's cheating. That just proxies out to a background job. Show me the background job."

That's the point! The background job was already implemented because we were using 95% of it for the email events from the vendors themselves. All we're doing is cutting out the middleman.

Don't don't roll your own

You always hear people in software development say you should never roll your own X. "Never roll your own auth or crypto or emails." There are very good and rational reasons not to mess with those. But you can’t throw the baby out with the bathwater. As you mature as an engineer or an engineering organization, you’ve got to start asking yourself which rules you're accomplished enough to break. (Or, as I've written on my personal blog: the people telling you not to roll your own thing tend to benefit from your instead asking them to handle it for you.)

The truth is that Jack Donaghey is right: vertical integration unlocks synergies. Here are some basic examples of things we get to do now that we've insourced this stuff:

  1. Start populating our database of IPs and user agents of bots to help strengthen our spam detection for subscription traffic.
  2. Surface conversion funnels for individual archive pages.
  3. Throttle (or accelerate) email sending in real time based on engagement metrics.

And all of this stuff is, in the background, cheaper and safer and more private.

Two cakes

Running a software company tends to be about trade-offs. You can try and move quickly at the cost of stability, performance, or polish. You can raise prices and increase short-term revenue, but at the cost of growth and customer goodwill. You can do a feature freeze and focus solely on performance and bug fixes for a month or two, but then you slow down your enterprise sales.

But! Every so often an option presents itself that allows you to have your cake and eat it too. This was one such option: we got to decrease tech debt, increase performance, improve our security posture, and decrease costs, all at the same time. And the only downside is that "success" looks like nothing changed at all, which gives me the opportunity to blog about it.