Aug 25, 2024
Can't Add Google Analytics to Chrome extension without api_secret ?
Can someone please help me add gtag to Chrome extension? My chrome extension includes a newtab.html page that overrides new tab. I found a tutorial here: https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/tutorial.google-analytics. and it's working well. But my concern is, is it ok if that <api_secret> mentioned in scripts/google-analytics.js in that repository to be in extension code?
I think it's impossible to hide such static API_SECRETS in chrome extension code. But I wanna know what happens if someone finds this particular <api_secret> and why that official tutorial added this in extension's client side code which anyone can see.
by the way, I generated that <api_secret> from:
Admin -> Data collections and modifications -> Data Streams -> selected my stream -> Measurement Protocol API secrets -> Create
Expecting to know if there's a way to link gtag without using api_secret. Or if there's no other way, what can possibly happen if this api_secret is known to public.
Details
Community content may not be verified or up-to-date. Learn more.
All Replies