Evidence

Overview

Evidence is an open-source BI framework that builds data apps and reports from SQL queries written in Markdown. It connects natively to BigQuery, making it straightforward to query the Decode GA4 events table and publish self-updating reports.

Requirements

  • Node.js v20 or later
  • A Decode GA4 installation with the events table accessible in BigQuery
  • A Google Cloud service account with BigQuery Data Viewer and BigQuery Job User roles on the project

Setup

1. Create an Evidence project

npm create evidence@latest
cd my-project
npm install

2. Configure the BigQuery connection

Start the dev server — Evidence will prompt you to configure a data source on first run:

npm run dev

Open http://localhost:3000, navigate to Settings → Data Sources, and add a BigQuery source with your project ID and service account credentials.

Alternatively, configure it directly in evidence.config.yaml:

sources:
  - name: decode_ga4
    type: bigquery
    options:
      project: your-gcp-project-id
      credentials_file: /path/to/service-account.json

3. Query the events table

Create a Markdown page (e.g. pages/pageviews.md) and add a SQL query block referencing the Decode GA4 events table:

```sql pageviews
select
    partition_date AS event_date,
    event_param.page_location,
    count(*) as pageviews
from your-gcp-project-id.your_dataset.events
where event_name = 'page_view'
group by partition_date, page_location
order by partition_date desc
```

Replace your_dataset with the dataset containing the Decode GA4 events table.

4. Visualise the results

Add a chart component below the query block:

<LineChart data={pageviews} x=event_date y=pageviews/>

Further Reading