ai

Creating an analytics dashboard for Easy Digital Downloads using AppSmith and ChatGPT

Bar chart titled MRR Overview from 2021 to 2023, part of the AppSmith analytics dashboard. Bars depict monthly recurring revenue, segmented into existing, new, voluntary churn, and delinquent churn. A line indicates net MRR with detailed values for March 2023.

We use Easy Digital Downloads to sell WP Fusion, and while it’s been good to us over the years, the reports leave a lot to be desired.

Discover insights with our analytics dashboard, featuring data from March 1-8, 2023. Two sales reached $160, averaging $80 per order. A line graph shows earnings trends, highlighting peak days. Powered by Easy Digital Downloads, note no new customers joined during this period.
EDD’s built in reports have gotten better with v3.0 but are still pretty basic.

To get better insights into churn, MRR, and active customers growth, I’d been using ProfitWell, which does a nice job, but has a few issues:

  1. No PayPal support: It’s integrated directly with Stripe (not EDD). About 20% of our revenue comes from PayPal, so that data is missing.
  2. Discounts: When we offer discounts (for example on Black Friday), EDD charges in Stripe this as a one-off payment for the discounted price, with a free trial for a year, and then the regular subscription begins. This means that new customers who sign up with a discount count as “trials” and don’t count towards MRR.
  3. Upgrades: When EDD processes an upgrade (for example from Plus to Professional), it cancels the customer’s current subscription, charges a pro-rated upgrade fee as a one-off, and then creates a new trialing subscription until the customer’s scheduled renewal date. In ProfitWell this counts as both a churned subscription and a trial— neither of which are true.

So, while we can spot some trends in ProfitWell, it’s far from accurate, especially with predicting recurring revenue.

For example look at the active customers count difference between ProfitWell and EDD— 1,137 in ProfitWell vs 2,154 in EDD. Not even close, yikes! 😬

Bar graph titled Customers Overview on the Easy Digital Downloads analytics dashboard displays monthly data from February 2022 to February 2023. It highlights active customers with segments for new, reactivations, existing, voluntary churn, and delinquent churn. Total customers: 1,137.
ProfitWell shows 1,137 active customers for February 2023
Screenshot of a subscription management page showing the total number of subscriptions (5097) with categories: Active (2154), Pending (0), Expired (30), Completed (0), Trialling (0), and Canceled. Dropdowns and a filter button are visible.
But in Easy Digital Downloads, we have 2,154 active customers 😦. Not even close!

In search of a solution

Every year, I publish a Year in Review for WP Fusion where we go through a bunch of metrics.

This is a fun way to “build in public”, and it’s also a good chance to spend some time reviewing everything internally, to try and identify weaknesses, etc.

In years prior, I’d done all of this “by hand”— exporting the EDD order data as .csvs, and between a few different spreadsheet apps and having to re-learn what a pivot table is, I’d come up with some pretty charts.

Of course this is very time consuming, and the data quickly gets stale.

Bringing in help 🤖

This year I was messing around with ChatGPT and thought, hey, maybe it can help me with some of these reports. And, surprise, surprise, it turned out to be very helpful! 🤩

Very helpful!

Great, I’ve got a way to query the data, now just how to display it…

In the past I’ve worked with Klipfolio, and I briefly experimented with their new PowerMetrics tool, but I didn’t really love the UI, or the way that each query needed to be configured with its own connection to our database.

Appsmith

I ended up using Appsmith, which I like for a few reasons:

  • It’s open source (like us!) with an option to self-host
  • They have a free cloud plan
  • The charts are built using FusionCharts which means if we need something not supported in the UI, we can code it (or have ChatGPT code it for us 😈)
  • Projects can be synced to Github, making it easy to share and collaborate (our repo for this project is here)

Bringing it all together

The process is pretty easy:

  1. Figure out what you want to know about your data
  2. Ask ChatGPT to write the query
  3. Test it in AppSmith, refine as needed (ChatGPT does well but it often needs to be corrected or coached a bit)
  4. Drop a chart onto a page
  5. Customize the chart JS config to get the right look and feel

Once I got in the rhythm, things went pretty fast, and now we have 34 new BI charts that are updating in real time from our EDD store 🎉.

How much does the AI contribute?

I’d say ChatGPT takes me from an intermediate developer to an advanced one, in terms of SQL.

The best results come out of clear prompts, which means you need to know a bit about your data and how it’s organized.

For example:

I need an SQL query that will sort my Easy Digital Downloads customers by lifetime value.

☝️ this doesn’t work.

ChatGPT makes up the table names, columns, and doesn’t understand their relationships with each other.

Screenshot of SQL query code using AppSmith for an Analytics Dashboard. The query selects email and total earnings as customer value from joined tables: wp_customers, wp_edd_payments, and wp_edd_payment_meta, filtering by status, grouping by email, and ordering by customer value in descending order.
This looks sensible but doesn’t do anything.

But, if you’re clear, it can be really powerful.

Here’s an updated prompt:

Let me give you some more information.

My customers are stored in the wp_edd_customers table. Each customer has an ‘id’ and ’email’. My orders are stored in the wp_edd_orders table.

Each order has a ‘customer_id’ which corresponds to the ‘id’ from the wp_edd_customers. Each order also has a ‘total’, and a ‘status’.

I’d like the report to output my top 10 customer email addresses based on their lifetime order value. Orders with a status of ‘refunded’ should be excluded.

Can you give me the SQL for this?

Then we get a helpful result:

The screenshot captures a tech article featuring a SQL query in striking white on black. This query efficiently retrieves customer email addresses and lifetime order values from Easy Digital Downloads, organizing them by total value and limiting the display to the top 10 results.

The most complicated query we came up (yes, we 😅🤖) calculates existing MRR by month.

The logic is:

  1. For each of the prior 24 months
  2. count the subscribers who were created or made a renewal payment in the 12 month period prior,
  3. (who did not have a refund)
  4. then calculate their MRR either based on their initial payment amount or recurring payment amount depending on whether or not it was the first year of their subscription
  5. and divide by 12.

That came out like

SELECT
  DATE_FORMAT(months.first_day, '%Y-%m') AS month,
  COUNT(DISTINCT s.id) AS subscriptions,
  ROUND( SUM(
    CASE
      WHEN s.created >= DATE_SUB(s.created, INTERVAL 12 MONTH) THEN
        s.initial_amount / 12
      ELSE
        s.recurring_amount / 12
    END
  ), 2 ) AS mrr
FROM
  wp_edd_subscriptions AS s
  JOIN (
    SELECT
      DATE_FORMAT(DATE_SUB(NOW(), INTERVAL n MONTH), '%Y-%m-01') AS first_day
    FROM
      (SELECT 0 AS n UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 22 UNION ALL SELECT 23) AS n
  ) AS months
	ON
  (s.created < months.first_day AND
  (s.expiration >= months.first_day))
WHERE
  NOT EXISTS (
    SELECT
      1
    FROM
      wp_edd_orders
    WHERE
      ( parent = s.parent_payment_id OR id = s.parent_payment_id )
			AND status = 'refunded'
  )
GROUP BY
  month;

😰 that one took a fair bit of trial and error, and I’m still only 90% confident in the accuracy, but it’s far beyond what I could have come up with on my own 🚀.

Charts!

You can see more examples in our 2022 in Review, but here are a few highlights.

Bar chart titled Subscribers Overview on the analytics dashboard reveals trends from March 2021 to January 2023, with categories including Existing, New, Voluntary Churn, Delinquent Churn, and Net Subscribers. In January 2023, AppSmith highlights show 2.32K existing users and a net gain of 2.31K.
Accurate active subscribers chart, showing net subscribers, new, and voluntary / delinquent churn
Bar chart visualizing monthly recurring revenue (MRR) from January 2022 to March 2023 on an Easy Digital Downloads analytics dashboard. Data covers existing, new, churn, and delinquent churn categories. March 2023 net new breakdown: +$493.3 new, -$296.94 voluntary churn.
MRR by month with summary
Bar chart on the analytics dashboard displays monthly revenue growth from 2021 to 2023. Green bars show new revenue, red for voluntary churn, orange for delinquent churn. A line graph shows growth rate, with Sept 2022 at 0.85% and new revenue $1.6K—powered by Easy Digital Downloads.
Growth rate
An analytics dashboard crafted with AppSmith displays WordPress site stats: Active Sites total 21,559 in the top-left box. Below, pie charts showcase License Statuses, Plugin Versions, and CRM Popularity, each with segments labeled by percentage for easy digital insights.
Active sites, license, and usage stats
Two bar graphs on the analytics dashboard illustrate Demo Signups by Month in red and Demo Conversion Rate by Month in purple, from January 2018 to January 2021. Signups peak in late 2018; conversion rate peaks mid-2018, with fluctuations throughout using Easy Digital Downloads data.
Demo signups and conversion rates

Cool! I want it! 👋

No problem! You can fork the project on Github, install it in your own Appsmith account, and connect it to your own EDD data in just a few clicks.

If you come up with any cool charts (or find anything funny with our queries 🫢), let us know on Github.

// thread

2 notes

Leave a Reply

Your email address will not be published. Required fields are marked *