Skip to content

Phase 3: Analytics conversion tracking, campaign plan + contact-form fix#25

Draft
willyd61 wants to merge 1 commit into
mainfrom
feature/pid-analytics-campaign
Draft

Phase 3: Analytics conversion tracking, campaign plan + contact-form fix#25
willyd61 wants to merge 1 commit into
mainfrom
feature/pid-analytics-campaign

Conversation

@willyd61

@willyd61 willyd61 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 3 — analytics & campaign readiness. Turns the site's existing GA4/GTM setup into proper conversion tracking, adds the campaign & measurement docs, fixes a live contact-form UX bug, and generates the authoritative Instagram calendar from the committed workbook.

1. Conversion tracking (js/pleasure-island-scripts.js)

  • New trackConversion() fires semantic GA4 key events: generate_lead (contact), newsletter_signup, request_consultation (booking link), phone_call (tel:) — replacing the ad-hoc form_submit. Plus email_click engagement.
  • Added phone/email/booking click tracking that didn't exist before — the highest-value signals for a local service business.
  • Google Ads conversions fire automatically once an AW- ID + labels are set (window.PID_ANALYTICS.googleAds or the ADS defaults). Dormant and side-effect-free until configured.
  • Verified end-to-end in headless Chromium: phone_call, email_click, request_consultation all fire; no Ads call fires without config.

2. 🐛 Contact-form UX fix (from a live report)

A screenshot showed the production form returning a generic "Something went wrong." Root cause: the JS never read the server response, so server-side validation failures (e.g. a message under the 10-char minimum) surfaced as a generic error.

  • The handler now parses the response and shows the server's specific reason (validation / rate-limit).
  • Client validation now mirrors the server (name ≥ 2, message ≥ 10). Verified: the exact 9-char input from the report now shows "…your message needs at least 10 characters."

⚠️ Note: the live site is running pre–Phase-1 code (old logo, no Swag Shop). The merged fixes — including the Phase 1 mail() resilience fix that stops the 500s — won't take effect until production is redeployed (cPanel → Git Version Control → Update → Deploy HEAD Commit).

3. Docs

  • docs/pid/marketing/measurement-plan.md — event catalog, GA4 key-event setup, Google Ads conversion import/config, DebugView QA, call-tracking note.
  • docs/pid/marketing/30-day-campaign-plan.md — objective/positioning, channel mix + budget allocation, weekly cadence tied to the IG calendar, KPIs/targets, launch checklist, day-30 review.

4. Instagram calendar (unblocked)

The source workbook is committed at docs/pid/marketing/social/instagram-30-day-calendar.xlsx, so I generated the authoritative automation/instagram/content-calendar.json from it and added Excel-serial→ISO date conversion to parse_calendar.py (dates now real: 2025-08-11 → 2025-09-06). The calendar is now tracked (reproducible from the committed workbook); queue/bundles stay build artifacts.

Testing

  • ✅ HTMLHint / Stylelint / ESLint pass
  • ✅ 43/43 PHP unit tests pass
  • ✅ Conversion events + contact-form UX verified end-to-end in headless Chromium
  • ✅ Calendar parse is reproducible from the committed workbook

Action required

  • Deploy main to production (the biggest one — the live site is stale).
  • To activate live reviews: set GOOGLE_PLACES_API_KEY + GOOGLE_PLACE_ID.
  • To activate Ads conversions: set the AW- ID/labels per the measurement plan.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R2zjTE7NTsrMH1FT6iwdc9


Generated by Claude Code

…, contact-form UX fix

Phase 3 — analytics & campaign readiness.

Conversion tracking (js/pleasure-island-scripts.js):
- New trackConversion() fires semantic GA4 key events — generate_lead (contact),
  newsletter_signup, request_consultation (booking link), phone_call (tel:) —
  replacing the ad-hoc form_submit event, plus email_click engagement.
- Added phone/email/booking click tracking that previously didn't exist.
- Google Ads conversions fire automatically once an AW- conversion ID + labels
  are configured (via window.PID_ANALYTICS.googleAds or the ADS defaults);
  dormant and side-effect-free until then.

Contact-form UX fix (surfaced by a live report):
- The form showed a generic "Something went wrong" for server-side validation
  failures because the JS never read the response. It now parses the response
  and shows the server's specific reason (e.g. message-too-short, rate-limit).
- Client-side validation now mirrors the server (name >= 2, message >= 10 chars)
  so users get actionable feedback before submitting — a 9-char message no
  longer looks like a server error. Verified in a headless browser.

Docs:
- docs/pid/marketing/measurement-plan.md — event catalog, GA4 key-event setup,
  Google Ads conversion import/config, DebugView QA, call-tracking note.
- docs/pid/marketing/30-day-campaign-plan.md — objective/positioning, channel
  mix + budget allocation, weekly cadence tied to the IG calendar, KPIs/targets,
  launch checklist (incl. the cPanel deploy step), day-30 review.

Instagram calendar (unblocked):
- The source workbook is committed at docs/pid/marketing/social/. Generated the
  authoritative automation/instagram/content-calendar.json from it and added
  Excel-serial→ISO date conversion to parse_calendar.py (dates now real:
  2025-08-11 → 2025-09-06). content-calendar.json is now tracked (reproducible
  from the committed workbook); queue/bundles remain build artifacts.

All linters pass (HTMLHint/Stylelint/ESLint); 43/43 PHP unit tests pass;
conversion events + form UX verified end-to-end in headless Chromium.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2zjTE7NTsrMH1FT6iwdc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants