DIY Email Attribution

IntroCave Updates

A bunch of lemurs sitting around discussing email attribution windows. The one with the twitchy eye is in charge of choosing how many days to use.

DIY Email Attribution

I'm a huge fan of Google Analytics, but Google isn't psychic. When I started sending out email newsletters last year, I set up basic UTM tracking. These are parameters in the URL that tell Google Analytics where a user comes from, which means I can do things like credit purchases to that source and find out how well a newsletter is performing. Looking at GA, I felt like my newsletters weren't doing much. As I set out to build some basic lifecycle email flows, this remained a huge source of worry.

And yet...

There were other signs that the newsletters weren't actually doing that badly. Repeat visits are way up since last year. What I call "fake organic" traffic is up quite a bit ("fake organic" is organic traffic that comes in on search terms like "introcave" or "intro cave" -- yeah, sure, it's organic in that Google sent me the click but that user was proooobably looking for me specifically).

It got me thinking. What if my email problem was actually an email attribution problem?

One thing I've noticed from poking through my MailGun stats is that emails live a LONG time. I routinely see people clicking through to the site from emails I sent 8 months ago. MailGun (and most Email Service Providers) offers webhooks for events like "opened" and "clicked" but doesn't store that data long-term. In order to start tracking this myself, I decided to start storing this data in my database.

Step 1: Figure Out How to Store the Data

Add a column to your database to capture marketing events. Look at what attributes your email service provider passes along with its webhooks and choose which fields you want to capture. The most important things to me were event ("open","clicked"), category ("newsletter","auth",etc), and source (the individual newsletters). I additionally added a column to flag whether this was a marketing source (and hence attributable) or just a basic account email (registration, forgot password, order complete). In order to make my life easier, I also added an event_id and source column to my orders table so that I can pull aggregate stats without doing so many JOINs.

Step 2: Capture the Data

In order for the data to get into your database, you'll need to wire up a web route—a URL that your ESP can post event data to. I chose to wire up a single route for all the webhooks I'm capturing and add a little logic to pull out the event type and additional parameters as needed.

Step 3: Choose your attribution window.

This is actually one of the harder steps. Google Analytics offers a bunch of different clever attribution models, but for this DIY attribution I basically just want one: days since the last event. Choose one that's too short and you basically won't attribute any purchases to emails unless a user purchases immediately after clicking through from the email. I feel like GA handles this use case pretty well already. Choose one that's too long and you'll be taking credit for repeat purchases that likely would've happened anyway (roughly 20% of IntroCave's purchases were repeat buyers even before I started sending out email). I looked around at some different ad networks and ultimately settled on a 14-day window.

Step 4: Attribute all the things!

I set up the webhooks to capture event data back in January, so now I've got about two full months worth of data. Now that I have some historical data to work with, I "turned on" the logic to start attributing new orders. Additionally, I backfilled all orders in the last couple of months. The biggest benefit of storing my attribution as a relationship separate from my event data is that I can go back and change my attribution window if I want and re-run all the attribution.

Results

So, how am I doing? According to Google Analytics, about 0.5% of my traffic comes from email (just getting started!) and about 2.5% of my sales come from email. Using a 14-day attribution window, email jumps up to closer to 5% of my sales. It's not a 10x improvement that's going to lead to an avalanche of emails in my poor customers' inboxes, BUT it is a significant jump. As a bonus, I'm super excited to be able to measure the long tail of some of these emails—I've already seen sales coming through off the very first newsletter I sent out last July!

Previous Article
Next Article