Skip to main content
Supabase integration enables you to connect your Supabase PostgreSQL database directly to Kasava for tracking product goal metrics using custom SQL queries or the visual query builder.

Overview

The Supabase integration provides:
  • Direct Database Access - Connect to your Supabase PostgreSQL database to query any table
  • Visual Query Builder - Build metrics using a point-and-click interface without writing SQL
  • Custom SQL Queries - Write raw SQL for complex metric calculations
  • Live Data - Metrics refresh automatically on configurable intervals

Prerequisites

Before connecting Supabase, you’ll need:
  • A Supabase project with an active PostgreSQL database
  • Your Supabase Project URL (found in Project Settings)
  • Your database password
For production use, we recommend creating a read-only database role with access only to the tables you need for metrics. This follows the principle of least privilege.

Connecting Supabase

1

Navigate to Settings

Click your profile menu and select Settings, then go to the Integrations tab
2

Find Supabase

Scroll to the Analytics & Data section and click Connect on the Supabase card
3

Enter Integration Name

Give your integration a descriptive name (e.g., “Production Database” or “My Supabase Database”)
4

Enter Project URL

Find your Project URL in Supabase under Project Settings > General. It looks like:
https://abcdefghijkl.supabase.co
You can paste the full URL or just the project reference (e.g., abcdefghijkl)
5

Enter Database Password

Find your database password in Supabase under Project Settings > Database > Connection string. This is the password you set when creating your project.
6

Configure Connection Pooler

Enable Use connection pooler (recommended). Connection pooling improves performance and prevents connection exhaustion.
7

Save

Click Connect to save the integration. Kasava will test the connection and confirm if successful.
Supabase configuration form with project URL, password, and pooler checkbox

Finding Your Supabase Credentials

Project URL

  1. Open your Supabase Dashboard
  2. Select your project
  3. Go to Project Settings > General
  4. Copy the Project URL from the API section
Supabase dashboard showing Project URL location

Database Password

  1. Go to Project Settings > Database
  2. Under Connection string, you’ll find options to reveal your password
  3. If you’ve forgotten your password, you can reset it from this page
Never share your database password publicly. Kasava encrypts your credentials at rest and they are never exposed in the UI after initial entry.

Linking Metrics to Goals

Once connected, you can link Supabase database metrics to track product goal progress automatically.
1

Open a Goal

Navigate to your Product’s Analysis > Goals tab and click on a goal
2

Add Metric

In the goal detail dialog, click Add Metric
3

Select Supabase

Choose Supabase as the data source
4

Configure Query

Use the Visual Builder or Raw SQL mode to define your metric (see Query Modes below)
5

Test Query

Click Test Query to verify the configuration returns data
6

Set Refresh Interval

Choose how often the metric should update: Hourly, Daily, or Weekly
7

Save

Click Link Metric to connect it to your goal
Goal detail dialog with Supabase metric configuration

Query Modes

Kasava provides two ways to define metrics from your Supabase database:

Visual Builder

The Visual Builder lets you create metrics without writing SQL. Simply select your options from dropdown menus.
FieldDescription
TableSelect any table or view from your database
AggregationCount, Sum, Average, Maximum, Minimum, or Count Distinct
ColumnFor non-count aggregations, select the column to aggregate
Time ColumnOptional: Filter by a timestamp column
Time RangeLast 24 hours, 7 days, 30 days, 90 days, 365 days, or All time
Example configurations:
GoalTableAggregationColumnTime Range
Total UsersusersCount-All time
Monthly Active UserssessionsCount Distinctuser_idLast 30 days
Total RevenueordersSumamountLast 30 days
Average Order ValueordersAverageamountLast 7 days

Raw SQL

For complex metrics that can’t be expressed with the Visual Builder, switch to Raw SQL mode and write your own query.
SELECT COUNT(*)
FROM users
WHERE created_at > NOW() - INTERVAL '30 days'
  AND subscription_status = 'active'
Your SQL query must return exactly one row with one numeric column. Complex queries with multiple columns or rows are not supported for goal tracking.
Example SQL queries:
-- Conversion rate
SELECT ROUND(
  COUNT(CASE WHEN status = 'converted' THEN 1 END)::numeric /
  NULLIF(COUNT(*), 0) * 100,
  2
) AS conversion_rate
FROM leads
WHERE created_at > NOW() - INTERVAL '30 days'
-- Net Promoter Score
SELECT ROUND(
  (COUNT(CASE WHEN score >= 9 THEN 1 END)::numeric -
   COUNT(CASE WHEN score <= 6 THEN 1 END)::numeric) /
  NULLIF(COUNT(*), 0) * 100
) AS nps
FROM survey_responses
WHERE created_at > NOW() - INTERVAL '90 days'
-- Monthly recurring revenue from subscriptions
SELECT COALESCE(SUM(
  CASE
    WHEN billing_interval = 'monthly' THEN amount
    WHEN billing_interval = 'yearly' THEN amount / 12
  END
), 0) AS mrr
FROM subscriptions
WHERE status = 'active'

Supported Aggregations

AggregationDescriptionRequires Column
CountCount total rowsNo
SumSum of numeric valuesYes (numeric column)
AverageAverage of numeric valuesYes (numeric column)
MaximumHighest valueYes (numeric column)
MinimumLowest valueYes (numeric column)
Count DistinctCount unique valuesYes (any column)

Time Filtering

When using the Visual Builder, you can optionally filter by a timestamp column:
Time RangeDescription
Last 24 hoursData from the past day
Last 7 daysData from the past week
Last 30 daysData from the past month
Last 90 daysData from the past quarter
Last 365 daysData from the past year
All timeNo time filter applied
The time column must be a timestamp, timestamptz, date, or datetime type.

Refresh Intervals

Linked metrics automatically refresh based on your configured interval:
IntervalDescription
HourlyMetrics update every hour (best for real-time monitoring)
DailyMetrics update once per day (recommended for most goals)
WeeklyMetrics update weekly (best for long-term trends)

Troubleshooting

Verify that:
  1. Your Project URL is correct and includes the full domain (e.g., abcdefghijkl.supabase.co)
  2. Your database password is correct
  3. Your Supabase project is active (not paused)
  • Ensure your database user has SELECT permissions on the tables
  • Check that the tables exist in the public schema (or switch schemas in the table dropdown)
  • Views are also supported if you need to expose computed data
  • Verify the time range includes data (try extending to 30 days or All time)
  • Check that the selected table has rows
  • For aggregate metrics, ensure the column contains numeric data
  • Ensure Use connection pooler is enabled
  • Check that your Supabase project isn’t paused due to inactivity
  • Verify your project’s database isn’t under heavy load
Your database role may not have access to certain tables. Either:
  • Grant SELECT permissions on the required tables
  • Use a database role with broader read access

Security Best Practices

Use a Read-Only Role

Create a dedicated database role with read-only access to only the tables needed for metrics. This limits exposure if credentials are compromised.
-- Example: Create a read-only role for Kasava
CREATE ROLE kasava_readonly WITH LOGIN PASSWORD 'your_secure_password';
GRANT USAGE ON SCHEMA public TO kasava_readonly;
GRANT SELECT ON users, orders, sessions TO kasava_readonly;

Security

  • Database credentials are encrypted at rest
  • Credentials are never exposed in the UI after initial entry
  • You can revoke access anytime by changing your database password or deleting the integration
  • Kasava only performs read operations (SELECT queries)
  • Connection pooler support prevents connection exhaustion