# GTM Configuration Guide – CTA and Conversion Tracking

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

Instructions for configuring Google Tag Manager (GTM) container `GTM-5DWSFND` to correctly track CTA clicks and conversion events. Follow these steps to narrow the `buttonclick_demo_testen` trigger and improve funnel accuracy.

## Reference

- [GTM_IMPLEMENTATION_STEPS.md](GTM_IMPLEMENTATION_STEPS.md) – Step-by-step manual GTM tasks (CTA + form_submit)
- [CTA_FUNNEL_ANALYSIS_2026-02.md](CTA_FUNNEL_ANALYSIS_2026-02.md) – Funnel analysis and GTM trigger issues
- [CONVERSION_POINTS_AUDIT.md](CONVERSION_POINTS_AUDIT.md) – Full conversion points inventory
- [ANALYTICS_API_AUTOMATION.md](ANALYTICS_API_AUTOMATION.md) – API scripts for GTM and GA4 configuration

## CTA Trigger Narrowing

### Problem

The `buttonclick_demo_testen` event currently fires on too many clicks:

- Tool cards (e.g. Zuschlagsrechner) – navigates away, 0% conversion
- Header/nav links – not lead CTAs
- Calculator form labels – not CTAs

This dilutes the funnel completion rate to ~11% instead of the true ~25–35% for real CTAs.

### Solution: Use `cta_click` Custom Event

The codebase now pushes `cta_click` to dataLayer when a user clicks an element with `data-event-type="button_click"` (see `v2/base/footer.php`).

**Recommended GTM configuration:**

1. **Create Custom Event Trigger**

   - **Trigger Name:** `CTA Click - Custom Event`
   - **Trigger Type:** Custom Event
   - **Event name:** `cta_click`
   - **This trigger fires on:** All Custom Events

2. **Create DataLayer Variables**

   - **DLV - CTA Name** – Data Layer Variable, `cta_name`
   - **DLV - CTA Location** – Data Layer Variable, `cta_location`

3. **Update GA4 Tag for CTA Clicks**

   - **Option A:** Change the existing `buttonclick_demo_testen` tag to fire on `CTA Click - Custom Event` instead of the generic click trigger.
   - **Option B:** Create a new GA4 Event tag:
     - **Event Name:** `cta_click` (or keep `buttonclick_demo_testen` for backward compatibility)
     - **Event Parameters:**
       - `cta_name` → `{{DLV - CTA Name}}`
       - `cta_location` → `{{DLV - CTA Location}}`
     - **Triggering:** `CTA Click - Custom Event`

4. **Disable or Remove**

   - Disable the old trigger that fired `buttonclick_demo_testen` on generic clicks (e.g. all clicks, or click text matching).

### Alternative: Use Click Trigger with Element Filter

If you prefer not to use the custom event:

1. **Trigger Type:** Click – All Elements
2. **This trigger fires on:** Some Clicks
3. **Conditions:**
   - **Click Element** matches CSS selector `[data-event-type="button_click"]`
   - **Click URL** does not contain `/tools/` (to exclude tool cards that navigate away)

4. **Exclude tool cards:** Add condition: `Click Element` matches `[data-event-type="button_click"]` (tool cards typically do not have this attribute; they are `<a href="/tools/...">`).

### Valid `data-event-name` Values (for reference)

Include only these when using click-based filtering:

- `Kostenlos testen`
- `Demo vereinbaren`
- `Rückruf anfordern`
- `Kostenlos testen (Comparison)`
- `View Plans (Comparison)`
- `Partner registrieren - Hero` (uses `link_click`, not `button_click`)

## Browser Validation Checklist

After implementing the code changes, validate with GTM Preview and GA4 DebugView. See [BROWSER_VALIDATION_CHECKLIST.md](BROWSER_VALIDATION_CHECKLIST.md) for the full repeatable checklist.

**Quick steps:**

1. **GTM Preview**
   - Open GTM container, click Preview, enter ordio.com URL
   - Navigate to homepage, tools page, comparison page

2. **CTA Click Tests**
   - Click "Kostenlos testen" (hero, footer, navbar) → verify `cta_click` fires in dataLayer
   - Click a tool card (e.g. Zuschlagsrechner) → verify `cta_click` does **not** fire (tool cards lack `data-event-type="button_click"`)
   - Click "Rückruf anfordern" → verify `cta_click` fires

3. **Form Submit Tests**
   - Submit demo form → verify `form_submit` with `conversion_type: demo_request`
   - Submit template download → verify `form_submit` with `conversion_type: template_download`
   - Submit tools export email modal → verify `form_submit` with `conversion_type: tools_export`

4. **GA4 DebugView**
   - Enable debug mode: `gtag('config', 'G-2JRTDQFVPZ', { 'debug_mode': true });` or use GA Debugger Chrome extension
   - Repeat CTA and form tests; verify events appear in DebugView with correct parameters

## Form Submission and `generate_lead`

### Ensure `form_submit` Maps to `generate_lead`

1. **Trigger:** Custom Event `form_submit`
2. **GA4 Tag:** Fire `generate_lead` event when `form_submit` is received
3. **Event Parameters:** Pass `form_id`, `form_type`, `conversion_type` (after implementation) to GA4

### GA4 Key Events

- Mark `generate_lead` as key event in GA4 Admin > Events
- Set counting method to **"Once per event"** (Google recommendation; see [GA4_EVENT_NAMING.md](GA4_EVENT_NAMING.md))

## Testing

1. **GTM Preview Mode**

   - Enable Preview
   - Click "Kostenlos testen" (hero, footer, navbar) → verify `cta_click` fires
   - Click a tool card on `/tools/` → verify `cta_click` does NOT fire
   - Submit a form → verify `form_submit` and `generate_lead` fire

2. **GA4 DebugView**

   - Enable Google Analytics Debugger Chrome extension or use GTM Preview (sends debug_mode)
   - Verify events appear with correct parameters

## GTM Best Practices

### Naming Conventions

Use clear, consistent names for tags, triggers, and variables:

- **Tags:** `GA4 Event - {event_name} - {context}` (e.g. `GA4 Event - generate_lead - form_submit`)
- **Triggers:** `{Type} - {Description}` (e.g. `CTA Click - Custom Event`, `Form Submit - All Forms`)
- **Variables:** `DLV - {Parameter}` for Data Layer Variables (e.g. `DLV - Conversion Type`)

### Constant Variables

Use a GTM Constant variable for the GA4 Measurement ID (`G-2JRTDQFVPZ`) instead of hardcoding. Simplifies future property changes.

### Version Descriptions

When publishing GTM versions, use descriptive names and notes:

- **Version name:** Reflect the change (e.g. "Narrow CTA trigger to cta_click")
- **Notes:** Who requested, what changed, why

## References

- [GTM_FORM_TRACKING_GUIDE.md](../../forms/GTM_FORM_TRACKING_GUIDE.md) – Form tracking setup
- [v2/base/footer.php](../../../v2/base/footer.php) – addTrackingToElements, cta_click dataLayer push
