Umami is a modern, privacy-focused alternative to Google Analytics. https://umami.is
Find a file
iskandarsulaili 7c1db78050 feat: Add UserMapping constraints and schema improvements
## Database Schema Enhancements

### Migration 19 - Fixed
- Removed invalid composite index on session(visitor_id, user_id)
- visitor_id column doesn't exist in session table
- Fixed migration to only create valid indexes

### Migration 20 - New Constraints (with rollback support)
- Added websiteId foreign key to UserMapping table
- Added foreign key constraint to Website table for referential integrity
- Added composite index on UserMapping(websiteId, userId) for query performance
- Added composite index on Session(websiteId, userId) for join optimization

### Schema Updates
- Updated UserMapping model with websiteId field
- Added foreign key relationship: UserMapping -> Website
- Added userMappings relation to Website model
- Added composite indexes for better query performance

## Files Changed

### Modified
- prisma/schema.prisma - Added foreign keys and composite indexes
- prisma/migrations/19_add_user_id_mapping/migration.sql - Fixed invalid index

### New
- prisma/migrations/20_add_user_mapping_constraints/migration.sql - Forward migration
- prisma/migrations/20_add_user_mapping_constraints/rollback.sql - Rollback script

## Benefits
-  Referential integrity enforced at database level
-  Optimized queries for Umami sync operations
-  Better join performance on Session table
-  Rollback capability for safe schema changes

## Breaking Changes
- UserMapping table now requires websiteId field
- Existing data will be migrated to use first available website_id

## Migration Notes
Run the migration with:
```bash
npx prisma migrate deploy
```

To rollback if needed:
```bash
psql -d umami -f prisma/migrations/20_add_user_mapping_constraints/rollback.sql
```
2025-11-06 22:04:57 +08:00
.github Merge branch 'master' into dev 2025-10-04 13:38:58 -07:00
.husky Card mode for tables. 2025-10-14 13:04:14 -07:00
cypress Add test for updating a website with only shareId 2025-08-19 14:43:42 +00:00
db feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
docker feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
podman Fixed typo in README.md 2025-04-17 19:08:25 +02:00
prisma feat: Add UserMapping constraints and schema improvements 2025-11-06 22:04:57 +08:00
public Updated lang files. 2025-10-06 12:11:26 -07:00
scripts Force geo build with BUILD_GEO env var. 2025-10-31 00:13:02 -07:00
src set maxHeight for DialogButton. remove from individual buttons 2025-11-04 09:34:37 -08:00
.dockerignore Fixed docker build. 2025-10-06 02:12:57 -07:00
.eslintignore Removed mysql schema. 2025-05-09 22:06:39 -07:00
.eslintrc.json Redesigned overview page. 2025-08-21 03:01:37 -07:00
.gitignore feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
.prettierignore Removed mysql schema. 2025-05-09 22:06:39 -07:00
.prettierrc.json Initial commit. 2020-07-17 01:03:38 -07:00
.stylelintrc.json Updated filter bar. 2025-04-02 23:18:03 -05:00
app.json Changed HASH_SALT to APP_SECRET. 2022-12-27 21:38:23 -08:00
cypress.config.ts add api-testing to cypress tests 2025-03-12 10:32:54 -07:00
docker-compose.upgraded.yml feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
docker-compose.yml ♻️ refactor(docker): remove versioning in docker compose file as it's deprecated 2025-02-21 15:04:48 +05:30
Dockerfile Updated Dockerfile to match current Prisma version. 2025-11-03 16:54:58 -08:00
jest.config.ts Fix test. 2025-03-31 22:49:34 -05:00
LICENSE Updated packages. 2022-12-26 20:50:55 -08:00
netlify.toml Adds @netlify/plugin-nextjs package & fixed dashboard link id 2022-10-25 15:01:49 +01:00
next-env.d.ts Redesigned overview page. 2025-08-21 03:01:37 -07:00
next.config.ts Add rewrite for script in cloud mode. 2025-10-08 16:01:47 -07:00
package.components.json Responsive everything. 2025-10-16 02:42:13 -07:00
package.json Force geo build with BUILD_GEO env var. 2025-10-31 00:13:02 -07:00
pnpm-lock.yaml feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
pnpm-workspace.yaml Added workspace file. 2025-04-29 10:41:12 -07:00
postcss.config.js Switched to type: module. 2025-04-29 14:36:52 -07:00
README.md feat: integrate First8 Marketing hyper-personalization system 2025-11-05 19:17:57 +08:00
rollup.tracker.config.js Switched to type: module. 2025-04-29 14:36:52 -07:00
tsconfig.json Converted UTM report to a view. 2025-05-20 21:25:06 -07:00
tsconfig.prisma.json Fixed outputs. 2025-09-01 16:17:55 -07:00
tsup.config.js Export metrics components. 2025-09-03 17:16:03 -07:00

Umami Logo

Umami

Umami is a simple, fast, privacy-focused alternative to Google Analytics.

GitHub Release MIT License Build Status Umami Demo


🚀 Getting Started

A detailed getting started guide can be found at umami.is/docs.


🛠 Installing from Source

Requirements

  • A server with Node.js version 18.18 or newer
  • A database. Umami supports PostgreSQL (minimum v12.14) databases.

Get the Source Code and Install Packages

git clone https://github.com/umami-software/umami.git
cd umami
pnpm install

Configure Umami

Create an .env file with the following:

DATABASE_URL=connection-url

The connection URL format:

postgresql://username:mypassword@localhost:5432/mydb

Build the Application

pnpm run build

The build step will create tables in your database if you are installing for the first time. It will also create a login user with username admin and password umami.

Start the Application

pnpm run start

By default, this will launch the application on http://localhost:3000. You will need to either proxy requests from your web server or change the port to serve the application directly.


🐳 Installing with Docker

To build the Umami container and start up a Postgres database, run:

docker compose up -d

Alternatively, to pull just the Umami Docker image with PostgreSQL support:

docker pull docker.umami.is/umami-software/umami:postgresql-latest

🔄 Getting Updates

To get the latest features, simply do a pull, install any new dependencies, and rebuild:

git pull
pnpm install
pnpm run build

To update the Docker image, simply pull the new images and rebuild:

docker compose pull
docker compose up --force-recreate -d

🎯 First8 Marketing Integration

This is a customized version of Umami Analytics integrated into the First8 Marketing Hyper-Personalized System. This implementation extends the standard Umami installation with:

Enhanced Features

  • PostgreSQL 17 with Apache AGE - Graph database capabilities for advanced relationship tracking
  • TimescaleDB Integration - Time-series optimization for analytics data
  • Extended Event Tracking - Comprehensive WordPress and WooCommerce event capture
  • Real-time Data Pipeline - ETL integration with the recommendation engine
  • Multi-dimensional Analytics - Contextual, behavioral, temporal, and journey tracking

System Architecture

This Umami instance serves as the data collection layer for the First8 Marketing hyper-personalization system:

WordPress Site → Umami Analytics → Recommendation Engine → Personalized Content

Data Flow:

  1. Collection: Umami captures all user interactions, page views, and WooCommerce events
  2. Storage: Events stored in PostgreSQL with TimescaleDB for time-series optimization
  3. Graph Analysis: Apache AGE enables relationship mapping between users, products, and behaviors
  4. ETL Pipeline: Real-time synchronization with the recommendation engine
  5. Personalization: ML models use analytics data to generate hyper-personalized recommendations

Integration Components

This Umami installation works in conjunction with:

  • First8 Marketing Track Plugin - WordPress connector for seamless event tracking
  • Recommendation Engine - Proprietary ML-powered personalization backend
  • First8 Marketing Recommendation Engine Plugin - WordPress connector for displaying personalized content

Database Enhancements

PostgreSQL Extensions:

  • Apache AGE 1.6.0 - Graph database for relationship mapping
  • TimescaleDB 2.23.0 - Time-series optimization for analytics queries
  • Prisma 6.18.0 - ORM for database management

Custom Schema Extensions:

  • User journey tracking tables
  • Product interaction graphs
  • Session behavior analysis
  • Purchase pattern storage

Configuration for First8 Marketing

Environment Variables:

DATABASE_URL=postgresql://username:password@localhost:5432/umami
NODE_ENV=production
PORT=3000

Required PostgreSQL Version: 17.x (for Apache AGE compatibility)

Usage in First8 Marketing System

Event Tracking:

  • All WordPress core events (page views, clicks, form submissions)
  • WooCommerce events (product views, add to cart, purchases, checkout steps)
  • Custom events via First8 Marketing Track plugin
  • User journey and session tracking

Data Access:

  • Real-time analytics dashboard via Umami UI
  • ETL pipeline for recommendation engine
  • Graph queries via Apache AGE for relationship analysis
  • Time-series queries via TimescaleDB for trend analysis

Deployment Notes

This instance is configured for standalone deployment with:

  • PostgreSQL 17 database server
  • Apache AGE graph extension
  • TimescaleDB time-series extension
  • Node.js 18.18+ runtime
  • Reverse proxy (Nginx/Apache) for production

Credits

Original Software:

First8 Marketing Customization:

  • Integration & Enhancement - First8 Marketing
  • PostgreSQL 17 + Apache AGE + TimescaleDB integration
  • Extended event tracking for WordPress/WooCommerce
  • ETL pipeline for recommendation engine
  • Custom schema extensions for hyper-personalization

🛟 Support

Original Umami Support:

GitHub Twitter LinkedIn Discord

First8 Marketing Integration Support:

  • For integration-specific issues, contact First8 Marketing
  • For core Umami issues, use the official Umami support channels above

📄 License

This project maintains the original MIT License from Umami Software.

Original Authors: Umami Software Integration & Customization: First8 Marketing