Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit 2ee398f

Browse files
authored
Merge pull request #30 from QuantumNous/auto-translate-18487627050
🌐 Auto-translate documentation
2 parents 2ce1987 + e7abb7f commit 2ee398f

File tree

4 files changed

+430
-20
lines changed

4 files changed

+430
-20
lines changed
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Analytics Tool Setup Guide
2+
3+
### Overview
4+
5+
New API now supports integration with popular analytics platforms to help you track user behavior and website performance:
6+
7+
- **Google Analytics 4 (GA4)**: The latest version of Google's analytics platform
8+
- **Umami Analytics**: A privacy-focused, open-source analytics tool
9+
10+
Both analytics tools can be enabled simultaneously without conflict.
11+
12+
### Key Features
13+
14+
βœ… Zero-code integration - configured solely via environment variables
15+
βœ… Automatically injects scripts into the Web interface
16+
βœ… Supports Docker and Standalone deployment
17+
βœ… Privacy-focused implementation
18+
βœ… No front-end code modification required
19+
20+
---
21+
22+
### Google Analytics 4 Setup
23+
24+
#### 1. Obtain Your Measurement ID
25+
26+
1. Visit [Google Analytics](https://analytics.google.com/)
27+
2. Create a new property or select an existing one
28+
3. Go to **Admin** β†’ **Data Streams**
29+
4. Create or select a web data stream
30+
5. Copy your **Measurement ID** (Format: `G-XXXXXXXXXX`)
31+
32+
#### 2. Configure Environment Variables
33+
34+
**Using Docker Compose:**
35+
36+
Edit the `docker-compose.yml` file and uncomment the Google Analytics line:
37+
38+
```yaml
39+
environment:
40+
- GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX # Replace with your actual Measurement ID
41+
```
42+
43+
**Standalone Deployment:**
44+
45+
Add to the `.env` file or set as an environment variable:
46+
47+
```bash
48+
export GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
49+
```
50+
51+
**Using Docker Run:**
52+
53+
```bash
54+
docker run -d \
55+
-e GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX \
56+
...兢他选鑹...
57+
calciumion/new-api:latest
58+
```
59+
60+
#### 3. Restart the Application
61+
62+
```bash
63+
# Docker Compose
64+
docker-compose down && docker-compose up -d
65+
66+
# Standalone Deployment
67+
# Restart your application directly
68+
```
69+
70+
---
71+
72+
### Umami Analytics Setup
73+
74+
#### 1. Obtain Umami Credentials
75+
76+
**Option A: Using Umami Cloud**
77+
1. Register on [Umami Cloud](https://cloud.umami.is/)
78+
2. Add a new website
79+
3. Copy your **Website ID** (UUID format)
80+
81+
**Option B: Self-hosting Umami**
82+
1. Deploy your own [Umami instance](https://umami.is/docs/install)
83+
2. Create a website in the dashboard
84+
3. Copy your **Website ID** and **Script URL**
85+
86+
#### 2. Configure Environment Variables
87+
88+
**Using Docker Compose:**
89+
90+
Edit the `docker-compose.yml` file:
91+
92+
```yaml
93+
environment:
94+
- UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
95+
# Optional: Only required for self-hosted instances
96+
- UMAMI_SCRIPT_URL=https://your-umami-domain.com/script.js
97+
```
98+
99+
**Standalone Deployment:**
100+
101+
Add to the `.env` file:
102+
103+
```bash
104+
export UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
105+
export UMAMI_SCRIPT_URL=https://your-umami-domain.com/script.js # Optional
106+
```
107+
108+
**Note:** If using Umami Cloud, you do not need to set `UMAMI_SCRIPT_URL`, as it defaults to the official URL.
109+
110+
#### 3. Restart the Application
111+
112+
Same as Google Analytics - restart the application to apply changes.
113+
114+
---
115+
116+
### Using Both Analytics Tools Simultaneously
117+
118+
You can enable both Google Analytics and Umami at the same time:
119+
120+
```yaml
121+
environment:
122+
- GOOGLE_ANALYTICS_ID=G-ABC123XYZ
123+
- UMAMI_WEBSITE_ID=a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6
124+
- UMAMI_SCRIPT_URL=https://analytics.umami.is/script.js
125+
```
126+
127+
---
128+
129+
### Verification
130+
131+
After restarting the application:
132+
133+
1. Open the Web interface in your browser
134+
2. Open browser developer tools (F12) β†’ **Network** tab
135+
3. Refresh the page
136+
4. Look for the following requests:
137+
- Google Analytics: `https://www.googletagmanager.com/gtag/js`
138+
- Umami: Your configured script URL
139+
140+
You can also check the page source code and look for the injected script in the `<head>` section.
141+
142+
---
143+
144+
### Troubleshooting
145+
146+
**Analytics tools not working?**
147+
148+
1. βœ… Verify that environment variables are set correctly
149+
2. βœ… Restart the application after changing variables
150+
3. βœ… Check the browser console for errors
151+
4. βœ… Ensure the Measurement ID/Website ID format is correct
152+
5. βœ… Check if ad blockers are interfering
153+
154+
**Docker Users:**
155+
156+
```bash
157+
# Check if environment variables are set
158+
docker exec new-api env | grep -E "GOOGLE_ANALYTICS|UMAMI"
159+
```
160+
161+
---
162+
163+
### Privacy Considerations
164+
165+
- Google Analytics collects user data according to the [Google Privacy Policy](https://policies.google.com/privacy)
166+
- Umami is privacy-focused and does not collect personal data
167+
- If using analytics tools, consider adding a privacy policy to your website
168+
- Both tools, when configured correctly, can comply with GDPR requirements
169+
170+
---
171+
172+
## Environment Variable Reference
173+
174+
| Variable | Required | Default Value | Description |
175+
|------|------|--------|------|
176+
| `GOOGLE_ANALYTICS_ID` | No | - | Google Analytics 4 Measurement ID (Format: G-XXXXXXXXXX)|
177+
| `UMAMI_WEBSITE_ID` | No | - | Umami Website ID (UUID format)|
178+
| `UMAMI_SCRIPT_URL` | No | `https://analytics.umami.is/script.js` | Umami script URL (Only required for self-hosted)|
179+
180+
---
181+
182+
## Related Links
183+
184+
- [Google Analytics](https://analytics.google.com/)
185+
- [Umami Analytics](https://umami.is/)
186+
- [Umami Documentation](https://umami.is/docs)
187+
- [Google Analytics Privacy](https://support.google.com/analytics/answer/6004245)
188+
189+
---
190+
191+
## Support
192+
193+
If you encounter any issues or have questions, please:
194+
- Submit an issue on [GitHub](https://github.com/Calcium-Ion/new-api/issues)
195+
- Check existing issues for solutions

β€Ždocs/en/wiki/index.mdβ€Ž

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ hide:
9999

100100
---
101101

102-
Learn about the goals and license of the New API project:
102+
Learn about the goals, licenses, and more for the New API project:
103103

104104
[View Details β†’](project-introduction.md)
105105

106106
- :material-star-outline:{ .twemoji }
107107

108-
**Feature Overview**
108+
**Feature Description**
109109

110110
---
111111

@@ -123,6 +123,16 @@ hide:
123123

124124
[View Details β†’](technical-architecture.md)
125125

126+
- :material-chart-line:{ .twemoji }
127+
128+
**Website Traffic Analysis**
129+
130+
---
131+
132+
Configure Google Analytics and Umami analysis tools:
133+
134+
[View Details β†’](analytics-setup.md)
135+
126136
</div>
127137

128138
## πŸ“ Project Records
@@ -135,7 +145,7 @@ hide:
135145

136146
---
137147

138-
Project version iterations and feature updates:
148+
Records of project version iterations and feature updates:
139149

140150
[View Records β†’](changelog.md)
141151

@@ -145,7 +155,7 @@ hide:
145155

146156
---
147157

148-
Thanks to all individuals and organizations who contributed to the project:
158+
Thanks to all individuals and organizations who have contributed to the project:
149159

150160
[View List β†’](special-thanks.md)
151161

@@ -157,14 +167,14 @@ hide:
157167
New API is a next-generation large model gateway and AI asset management system, designed to simplify the integration and management of AI models, providing unified API interfaces and resource management capabilities.
158168

159169
!!! tip "Why choose New API?"
160-
- Unified API interface supporting multiple mainstream large models
170+
- Unified API interface supporting various mainstream large models
161171
- Comprehensive resource management and monitoring capabilities
162172
- Complete ecosystem and secondary development capabilities
163173
- Active community support and continuous updates
164174

165-
!!! question "Have questions?"
175+
!!! question "Have Questions?"
166176
If you have any questions about the project, you can:
167177

168-
1. View the [FAQ](../support/faq.md)
178+
1. Check the [Frequently Asked Questions](../support/faq.md)
169179
2. Submit an issue on [GitHub](https://github.com/Calcium-Ion/new-api/issues)
170-
3. Join the [community](../support/community-interaction.md) for help
180+
3. Join the [Community Interaction](../support/community-interaction.md) for help

0 commit comments

Comments
Β (0)