# GTM Implementation Steps – Pending Manual Tasks

**Last Updated:** 2026-02-17

Step-by-step guide for the remaining manual GTM configuration. The codebase is ready; these changes must be made in the GTM UI (or via API after enabling Tag Manager API).

## Prerequisites

**For API automation (optional):** Enable Tag Manager API in GCP Console:
- https://console.cloud.google.com/apis/library/tagmanager.googleapis.com
- Grant service account (from `v2/config/google-api-credentials.json`) Edit access in GTM → Admin → User Management
- Then run: `php v2/scripts/dev-helpers/gtm-configure-cta-tracking.php --publish`

**For manual configuration:** Access to GTM container `GTM-5DWSFND`.

---

## Step 1: CTA Trigger Narrowing (Phase 1.1)

**Problem:** `buttonclick_demo_testen` fires on tool cards, nav links, calculator labels – diluting funnel to ~11% vs true ~25–35%.

**Action:** Narrow the CTA trigger to fire only on `cta_click` custom event.

### 1.1 Create Custom Event Trigger (if not exists)

1. GTM → **Triggers** → **New**
2. **Trigger Name:** `CTA Click - Custom Event`
3. **Trigger Type:** Custom Event
4. **Event name:** `cta_click`
5. **This trigger fires on:** All Custom Events
6. **Save**

### 1.2 Create Data Layer Variables (if not exist)

1. GTM → **Variables** → **New** (Data Layer Variable)
2. **Name:** `DLV - CTA Name` | **Data Layer Variable Name:** `cta_name`
3. **Name:** `DLV - CTA Location` | **Data Layer Variable Name:** `cta_location`

### 1.3 Create or Update GA4 CTA Tag

1. GTM → **Tags** → **New** (or edit existing)
2. **Tag Type:** Google Analytics: GA4 Event
3. **Configuration Tag:** Your GA4 Configuration tag
4. **Event Name:** `cta_click`
5. **Event Parameters:**
   - `cta_name` → `{{DLV - CTA Name}}`
   - `cta_location` → `{{DLV - CTA Location}}`
6. **Triggering:** `CTA Click - Custom Event`
7. **Save**

### 1.4 Disable Old Trigger

- Find the trigger that fires `buttonclick_demo_testen` on generic clicks (e.g. Click – All Elements)
- **Disable** or **Delete** it to stop funnel dilution

### 1.5 Validate

- GTM Preview → ordio.com
- Click "Kostenlos testen" → `cta_click` fires
- Click tool card (e.g. Zuschlagsrechner) → no CTA event

---

## Step 2: form_submit → generate_lead Mapping (Phase 1.2–1.3)

**Action:** Ensure GTM fires `generate_lead` when `form_submit` is received, with `conversion_type` and `form_id`.

### 2.1 Create DLV - Conversion Type (if not exists)

1. GTM → **Variables** → **New** (Data Layer Variable)
2. **Name:** `DLV - Conversion Type`
3. **Data Layer Variable Name:** `conversion_type`
4. **Save**

### 2.2 Create form_submit Trigger (if not exists)

1. GTM → **Triggers** → **New**
2. **Trigger Name:** `Form Submit - Custom Event`
3. **Trigger Type:** Custom Event
4. **Event name:** `form_submit`
5. **This trigger fires on:** All Custom Events
6. **Save**

### 2.3 Create generate_lead GA4 Tag

1. GTM → **Tags** → **New**
2. **Tag Type:** Google Analytics: GA4 Event
3. **Configuration Tag:** Your GA4 Configuration tag
4. **Event Name:** `generate_lead` (not `form_submit`)
5. **Event Parameters:**
   - `conversion_type` → `{{DLV - Conversion Type}}`
   - `form_id` → `{{DLV - Form ID}}`
6. **Triggering:** `Form Submit - Custom Event`
7. **Save**

### 2.4 Validate

- GTM Preview → ordio.com
- Submit demo form → `form_submit` in dataLayer → `generate_lead` tag fires
- GA4 DebugView → `generate_lead` with `conversion_type`, `form_id`

---

## Step 3: Publish and Verify

1. GTM → **Submit** (create version, add description)
2. **Publish**
3. Run [BROWSER_VALIDATION_CHECKLIST.md](BROWSER_VALIDATION_CHECKLIST.md)
4. Run `make validate-analytics` after 24–48 hours to confirm events in GA4

---

## Next Steps After GTM Is Configured

| Step | Action |
|------|--------|
| Browser validation | Run [BROWSER_VALIDATION_CHECKLIST.md](BROWSER_VALIDATION_CHECKLIST.md) |
| API validation | `make validate-analytics` (after data propagates) |
| Funnel analysis | `php v2/scripts/dev-helpers/ga4-cta-funnel-analysis.php` to verify improved completion rate |
| Optional: Enable Tag Manager API | For future `gtm-configure-cta-tracking.php` automation |

---

## References

- [GTM_CONFIGURATION_GUIDE.md](GTM_CONFIGURATION_GUIDE.md)
- [GTM_FORM_TRACKING_GUIDE.md](../../forms/GTM_FORM_TRACKING_GUIDE.md)
- [BROWSER_VALIDATION_CHECKLIST.md](BROWSER_VALIDATION_CHECKLIST.md)
- [ANALYTICS_API_AUTOMATION.md](ANALYTICS_API_AUTOMATION.md)
