We are working on an Open Source Chrome extension: Digital Assistant Client
I'm trying to send event and page view data to Google Analytics 4 (GA4) without using the gtag.js script or Google Tag Manager.
Instead, I followed the official documentation to use the Measurement Protocol API:
🔗 https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events
However, when making requests from the frontend, I'm running into CORS issues, and I also don’t want to expose my Measurement Protocol API secret key in the browser. Is there a recommended or secure way to send GA4 data without using gtag.js, Tag Manager, or exposing the API secret on the frontend?
Any help or suggestions would be greatly appreciated!