mirror of
https://github.com/complexcaresolutions/documentation.git
synced 2026-03-17 16:23:53 +00:00
96 lines
2.7 KiB
Markdown
96 lines
2.7 KiB
Markdown
# Analytics Integration
|
|
|
|
*Letzte Aktualisierung: 18. Dezember 2025*
|
|
|
|
---
|
|
|
|
## Übersicht
|
|
|
|
### 1. Umami Analytics (cookieless, ohne Consent)
|
|
|
|
- Umami-Server auf sv-analytics (10.10.181.103)
|
|
- Website-IDs für alle 4 Tenants
|
|
- UmamiScript Komponente in Layout
|
|
- useAnalytics Hook für Custom Events
|
|
- Server-Side Events für Backend-Actions
|
|
|
|
### 2. Google Ads Conversion (mit Consent)
|
|
|
|
- GoogleConsentMode Komponente (integriert mit Orestbida)
|
|
- useGclid Hook für Attribution
|
|
- Client-Side Conversions bei Consent
|
|
- Server-Side Conversions immer (gehashte Daten)
|
|
|
|
### 3. Cookie Inventory
|
|
|
|
- Google Ads Cookies dokumentieren (_gcl_au, _gcl_aw, IDE)
|
|
|
|
---
|
|
|
|
## Environment Variables
|
|
|
|
### Frontend (.env.local)
|
|
|
|
```env
|
|
NEXT_PUBLIC_PAYLOAD_URL=https://cms.c2sgmbh.de
|
|
NEXT_PUBLIC_API_URL=https://cms.c2sgmbh.de/api
|
|
NEXT_PUBLIC_UMAMI_HOST=https://analytics.c2sgmbh.de
|
|
NEXT_PUBLIC_TENANT_ID=4
|
|
NEXT_PUBLIC_TENANT_SLUG=c2s
|
|
NEXT_PUBLIC_GOOGLE_ADS_ID=AW-XXXXXXXXX
|
|
```
|
|
|
|
### Backend (.env)
|
|
|
|
```env
|
|
UMAMI_HOST=https://analytics.c2sgmbh.de
|
|
UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
GOOGLE_ADS_CUSTOMER_ID=1234567890
|
|
GOOGLE_ADS_CONVERSION_ACTION_ID=987654321
|
|
GOOGLE_ADS_API_TOKEN=ya29.xxx
|
|
GOOGLE_ADS_DEVELOPER_TOKEN=xxx
|
|
```
|
|
|
|
---
|
|
|
|
## Event-Naming-Konvention
|
|
|
|
| Event | Name | Data |
|
|
|-------|------|------|
|
|
| Newsletter Anmeldung | `newsletter_subscribe` | `{ source: string }` |
|
|
| Newsletter Bestätigung | `newsletter_confirm` | - |
|
|
| Kontaktformular | `contact_form_submit` | `{ form_type: string }` |
|
|
| CTA Klick | `cta_click` | `{ cta_name: string, location: string }` |
|
|
| Download | `download` | `{ file_name: string, file_type: string }` |
|
|
| Funnel-Step | `funnel_step` | `{ funnel: string, step: number }` |
|
|
| Scroll-Tiefe | `scroll_depth` | `{ depth_percent: number }` |
|
|
| Externer Link | `external_link` | `{ url: string }` |
|
|
|
|
---
|
|
|
|
## Dateien zu erstellen
|
|
|
|
```
|
|
src/
|
|
├── components/analytics/
|
|
│ ├── UmamiScript.tsx # Umami Tracking Script
|
|
│ └── GoogleConsentMode.tsx # Google Consent Mode v2
|
|
├── config/analytics.ts # Website-IDs, Config
|
|
├── hooks/
|
|
│ ├── useAnalytics.ts # Client-Side Events
|
|
│ └── useGclid.ts # GCLID Erfassung
|
|
└── lib/
|
|
├── analytics.server.ts # Umami Server-Side
|
|
├── google-ads.ts # Google Ads Client
|
|
└── google-ads.server.ts # Google Ads Server API
|
|
```
|
|
|
|
---
|
|
|
|
## Google Ads Cookies (für Cookie-Inventory)
|
|
|
|
| Name | Provider | Kategorie | Dauer |
|
|
|------|----------|-----------|-------|
|
|
| `_gcl_au` | Google Ads | marketing | 90 Tage |
|
|
| `_gcl_aw` | Google Ads | marketing | 90 Tage |
|
|
| `IDE` | Google (doubleclick.net) | marketing | 1 Jahr |
|