Summary Description: A cloud-powered hardware telemetry hub driven by the Google Analytics 4 (GA4) API. Extract granular, real-time user activity—from new sessions to specific button clicks—straight from the Google Cloud to your physical workspace.
What It Does
Google Cloud APISitePulse Analytics Edition is designed for enterprise environments and websites already heavily leveraging the GA4 ecosystem. It requires zero backend coding or custom PHP server files. Instead, your ESP32 hardware securely authenticates directly with Google Cloud using OAuth 2.0 to pull live metric streams. Let Google handle the heavy lifting of audience data collection, while your desk monitor provides physical, real-world alerts for granular actions: track when a new_session starts, monitor a specific page_view, or even get notified when a user triggers a custom click event on a specific CSS class.
Key Features
- No Backend Required: Operates entirely without custom PHP scripts or server modifications—connects directly to the Google Analytics Data API.
- Granular GA4 Event Tracking: Native support for core metrics like
page_viewandnew_session, alongside deep tracking for specific UI interactions (e.g., catching a click event tied to a specific button class or link). - Advanced Session Limiting: Gain total control over your notification frequency. Define exactly how many times a specific event triggers an alert per user session (e.g., beep only once per session for a standard page view, but beep every time a high-value button is clicked).
- Secure OAuth 2.0 Integration: Uses industry-standard refresh tokens to maintain a persistent, secure connection to your analytics data without exposing raw passwords.
- Macro Trend Monitoring: Perfect for visualizing sudden traffic surges or identifying user behavior patterns across your application in real-time.
Version History
- v3.0 (Current): Re-engineered for OAuth 2.0 (
GA_CLIENT_SECRETandGA_REFRESH_TOKEN) integration. Added granular event tracking (new_session,page_view, click classes) and per-session notification limits. - v2.0: Transitioned to the new GA4 Data API, allowing for specific event filtering and enhanced query capabilities.
- v1.0: Original cloud-integrated prototype built on the legacy Universal Analytics (UA) framework.
Configuration & Requirements
To deploy the Analytics Edition, you will need:
- An ESP32 microcontroller board.
- An active Google Analytics 4 (GA4) Property.
- Access to the Google Cloud Console to generate OAuth 2.0 credentials.
- Your local Wi-Fi network credentials.
How to Configure and Use
- Google Cloud Setup: Log into the Google Cloud Console, create a new project, and enable the Google Analytics Data API. Configure your OAuth Consent Screen.
- Generate OAuth Credentials: Create a set of OAuth 2.0 Client IDs (Desktop/Web App). You will be provided with a Client ID and a Client Secret.
- Obtain a Refresh Token: Use the Google OAuth 2.0 Playground (or a local script) to authorize your Google account and generate a permanent Refresh Token.
- Hardware Configuration: Open the
control.pyfile on your ESP32 and input your newly generated API credentials to authorize the device:GA_CLIENT_SECRET = "Your Google Cloud Client Secret"
GA_REFRESH_TOKEN = "Your permanent Refresh Token"
GA_PROPERTY_ID = "Your GA4 Property ID" - Event & Network Setup: Open your
settings.py(or designated config file) to set yourWIFI_SSIDandWIFI_PASS. Here, you will also define your tracking parameters (e.g., setting the target event to click, specifying the target CSS class, and configuring your per-session alert limits). - Launch: Save the files and execute the script. The ESP32 will use the refresh token to securely obtain an access token and begin polling GA4 for your designated user events.
Download & Source Code
Get the complete ESP32 Python scripts, API integration files, and deployment instructions directly from GitHub.
Latest Release: v3.0
View on GitHub ▹