JIMMY DAHLQVIST | 2024-04-17 Serverless website analytics with Lambda@Edge
JIMMY DAHLQVIST Serverless enthusiast AWS Ambassador | AWS Community Builder | User Group Leader Founder of serverless- handbook.com Head of AWS @ Sigma Technology Cloud § Hello, I'm
Todays agenda Episode I: The Problem Awakens Episode II: Birth of a Solution Episode III: Revenge of the Gotchas Episode IV: A New Refined Solution Episode V: The Live Demo Strikes Back
Episode I: The Problem Awakens
Website statistics Google Analytics Been my tracker for years Universal Analytics deprecated Way to advanced Open Source alternatives Plausible and Matomo Fathom Analytics Not free
I just want Easy way to understand my readers! How hard can it be? Could I track in the backend?
Episode II: Birth of a Solution
Thoughts No client side tracking Page, Time, and Country Can I use CloudFront?
CloudFront Integration points
Lambda@Edge vs CloudFront Functions Lambda@Edge All integration points Network access Up to 5 or 30 second duration CloudFront Functions Viewer Request / Response No network access Sub millisecon duration You can’t combine CloudFront Functions and Lambda@Edge
Decoupled and event-driven Event-driven solution Decouple Ingestion Storage Analytics
Ingestion
Data-store
Analytics
Episode III: Revenge of the Gotchas
Three problems Solution failed to deploy, cryptic error message There was missing data in Athena Page felt sluggish
Gotcha Lambda@Edge and Functions won’t combine Lambda@Edge -> EventBridge high latency Glue and new lines CloudFront headers in cache policy
Episode IV: A New Refined Solution
Needed to solve High Latency Time & Date Viewer type