Context
At Census (acquired by Fivetran), we had a freemium model and plenty of accounts that quietly stopped logging in. Nobody noticed until they were already gone. I built this to catch the fade before it turned into a cancellation. The approach - comparing engagement across two time periods and flagging the drop-offs - works for any company with event data in a warehouse.
The idea
High-value customers don't churn overnight. They slowly back away. The goal here was to catch that early - compare what a customer did in the last 60 days to what they did in the previous 60 days, score the trend, and use it to trigger a re-engagement campaign in Braze.
Two data points per customer: a current engagement score and the trend direction. That's enough to build a segment of high-value customers whose usage is declining.
How I built it
Step 1: Prep the data
Start with a SQL query that gives you one row per customer. For each customer, pull the events they did in the last 60 days and the events from the previous 60 days. You also need whatever defines "high value" for your business - for us it was loyalty status (gold, platinum, silver).
Step 2: Score the engagement
I used AI to compare the two periods and score each one from 1 to 10. The key is giving the model a framework for what matters. Not all events are equal - purchases, checkouts, and add-to-carts are high-value events. Product views and wishlist adds are interest signals. Logins and logouts are low-value.
The output is four fields per customer: current score, previous score, numeric change, and trend direction. You can set these up as separate columns so they come back as individual data points.
Before shipping anything, spot-check the scores. Pick a customer, look at their events, and see if the score makes sense. If the previous period had more activity and the score shows a decrease - it's working.
Step 3: Sync to Braze
Sync the engagement score, trend, and previous score back to Braze. Create a segment of high-value customers with a decreasing trend. Use it in any re-engagement campaign you want - the data is there, the segment builds itself.