Skip to content

v0.10.1 - Landing URL Marketing Tracking

Choose a tag to compare

@alexeykrol alexeykrol released this 11 Jan 04:47
· 30 commits to main since this release

v0.10.1 - Landing URL Marketing Tracking

📊 Major New Feature

Track landing page URLs with UTM parameters for complete marketing attribution.

Problem Solved

  • Track which Facebook ads/posts drive user registrations
  • Measure effectiveness of different landing pages
  • Preserve UTM parameters (e.g., ?utm=fb1) through authentication flow
  • Remove Facebook/Google tracking parameters (fbclid, gclid) for privacy

Implementation

Database Schema

  • Added landing_url TEXT column to wp_user_registrations table
  • Created index for analytics queries
  • Migration: supabase/add-landing-url-field.sql

Frontend (auth-form.html)

  • cleanTrackingParams() - Removes fbclid, gclid, msclkid, gbraid, wbraid
  • Captures document.referrer on auth form page
  • Magic Link: passes landing_url via URL parameter (cross-device compatible)
  • OAuth: saves landing_url to localStorage (same-device)

Callback Handler (callback.html)

  • Priority 1: Read from URL query param (Magic Link)
  • Priority 2: Read from localStorage (OAuth)
  • Priority 3: null (direct auth form access)

Backend (supabase-bridge.php)

  • Modified sb_log_registration_to_supabase() - added optional $landing_url parameter
  • Validates via sb_validate_url_path()
  • Backward compatible with existing code

Use Cases

  1. Paid Traffic: User clicks Facebook ad → lands on /page/?utm=fb1 → registers → landing_url saved
  2. SEO/Organic: User finds closed content → auth form → registers → landing_url = content page
  3. Direct Auth: User goes to auth form directly → registers → landing_url = null

Production Testing

✅ Deployed to production (alexeykrol.com)
✅ Tested with real Facebook ads traffic
✅ Verified UTM parameters: ?utm=afb_0003, ?utm=fbp_001, ?utm=pfb_0003
✅ Facebook tracking parameters removed correctly
✅ 100% landing URL attribution for new registrations
✅ Works with multiple landing pages and UTM codes

Results

  • Complete marketing attribution for Facebook ad campaigns
  • Track which specific posts drive conversions
  • UTM parameters preserved through entire auth flow
  • Privacy-friendly: only same-domain referrers, removes ad platform IDs
  • Cross-device Magic Link captures landing URL
  • Zero breaking changes

Files Modified

  • supabase/add-landing-url-field.sql - Database migration (NEW)
  • auth-form.html - Landing URL capture and cleaning (lines 849-891)
  • callback.html - Landing URL extraction (lines 371-391)
  • supabase-bridge.php - Backend integration (lines 602, 618-625, 663, 1633-1641, 1736)