Skip to content

Commit cd114be

Browse files
committed
add analytics notes
1 parent f37cc50 commit cd114be

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default defineConfig({
8989
items: [
9090
{ label: "Ecency SDK", slug: "developers/wallets" },
9191
{ label: "Ecency chats", slug: "developers/chats" },
92+
{ label: "Analytics", slug: "developers/analytics" },
9293
{ label: "API Reference", slug: "developers/api" }, // if you later add this
9394
{
9495
label: "Extra services",
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Ecency analytics
3+
description: Self-host Plausible Community Edition and connect it to an @ecency/web instance for privacy-friendly metrics.
4+
---
5+
6+
# Ecency analytics with Plausible
7+
8+
Ecency uses **Plausible Analytics** to track privacy-friendly usage metrics without cookies. This guide shows how to run the Plausible Community Edition and connect it to an `@ecency/web` deployment.
9+
10+
## Quickstart: run Plausible CE
11+
12+
Follow these steps on a host with Docker installed:
13+
14+
1. **Prepare system packages and clone Plausible CE.**
15+
```bash
16+
sudo apt update
17+
git clone -b v2.1.3 --single-branch https://github.com/plausible/community-edition plausible-ce
18+
cd plausible-ce
19+
```
20+
2. **Create your environment file.** Update the base URL to match the public hostname you will serve Plausible from.
21+
```bash
22+
touch .env
23+
echo "BASE_URL=https://pl.ecency.com" >> .env
24+
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
25+
echo "HTTP_PORT=80" >> .env
26+
echo "HTTPS_PORT=443" >> .env
27+
```
28+
3. **Expose Plausible ports locally.**
29+
```bash
30+
cat > compose.override.yml << 'YAML'
31+
services:
32+
plausible:
33+
ports:
34+
- 80:80
35+
- 443:443
36+
YAML
37+
```
38+
4. **Install Docker Compose and launch.**
39+
```bash
40+
sudo apt install docker.io
41+
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
42+
sudo chmod +x /usr/local/bin/docker-compose
43+
docker-compose --version
44+
docker-compose up -d
45+
```
46+
47+
The Plausible UI will now be reachable at the `BASE_URL` you set (e.g., `https://pl.ecency.com`). Log in, create your site (domain), and note the script URL from the **Settings → Script** page.
48+
49+
## Connect to `@ecency/web`
50+
51+
Add the Plausible script to your `@ecency/web` deployment so page views are sent to your instance:
52+
53+
1. **Set the Plausible environment variables.** In your web environment configuration (e.g., `.env.local`), add:
54+
```bash
55+
PLAUSIBLE_API_HOST=https://pl.ecency.com
56+
PLAUSIBLE_DOMAIN=ecency.com
57+
PLAUSIBLE_API_KEY=your_plausible_api_key
58+
```
59+
- Replace `pl.ecency.com` with the host where you run Plausible CE.
60+
- Set `PLAUSIBLE_DOMAIN` to the domain you added in Plausible.
61+
- Generate the **API key** from Plausible (**Settings → API keys**) so the site can send pageview events.
62+
2. **Include the tracking script.** Ensure your app template or `_document` injects Plausible:
63+
```html
64+
<script
65+
defer
66+
data-domain="${process.env.PLAUSIBLE_DOMAIN}"
67+
src="${process.env.PLAUSIBLE_API_HOST}/js/script.js"
68+
></script>
69+
```
70+
3. **Deploy and verify.** Redeploy `@ecency/web`, browse a few pages, and confirm events appear in the Plausible dashboard under **Realtime**.
71+
72+
By self-hosting Plausible CE, Ecency analytics stay lightweight, GDPR-friendly, and free from third-party trackers.

0 commit comments

Comments
 (0)