I have a React web app. I set up analytics as described in the documentation here : https://firebase.google.com/docs/analytics/get-started
With the help of the Analytics extension in Chrome, and in my dev environment, I can see the logs in the Debug view section. That means I setup analytics correctly in the app (I believe).
However, if I deploy my app to my https://myapp.web.app domain, nothing logs. I checked the Hosting section, and my app is correctly deployed and it is selected.
I updated my firebase sdk recently (8.7.0), and I added measurementId in the settings, although the doc says it's optional to use measurementId.
Am I missing something ? Is there any way to see if I'm missing something ?
Enabling Google Analytics involves API requests to Firebase Installations Service, to google-analytics.com and to googletagmanager.com`.
I use Firefox, because Chromium sends my computer CPU and RAM consumption to the moon, even with a single tab open. And in Firefox, unlike Chromium and Brave, among other browsers, I had nothing logged in the console.
Chromium and Brave logged API requests errors.
So, you need to add the Firebase Installations Service API key in the cloud console.
I feel this could be mentioned in the documentation, because it's not very obvious.
Anyway, someone explained it very clearly here : Firebase: 403 PERMISSION_DENIED (FirebaseError: Installations): Requests are blocked, after updating SDKs (FirebaseInstallationsService)
Now Firebase Analytics show logs when using Chromium.
However, these requests are blocked using Firefox and Brave (and therefore no logs are shown in Firebase Analytics). My understanding is it has to do with default settings in the browser.
With Brave, it's GET requests to googletagmanager.com/ that are blocked.
With Firefox, it's POST requests to google-analytics.com/ that are blocked. The above mentioned GET request is NOT blocked by Firefox.
https://rankfuse.com/blog/firefox-browser-blocking-google-analytics/
Does anyone know of a workaround ? I understand some Internet users can be annoyed by tracking systems such as GA, but Internet services need such tracking systems to improve their overall user experience, and if Internet browsers block analytics services, we are kind of stuck there.
EDIT: ok, so a bit of research about the above issue of browsers blocking analytics requests I came across various paid services purposely defined as workarounds and various tricks to bypass analytics blocking.
One straightforward way is to obviously proxy requests from your user's browser to google-analytics.com. There is a good article here that explains how to proceed can be found here: https://iainbean.com/posts/2020/the-shady-world-of-google-analytics-proxying/
Related
I'm trying to implement the Google Analytics's Workbox Plugin on my application, which works most of the time offline. I used the webpack plugin as well to generate the service worker (SW). I used the method GenerateSW({offlineGoogleAnalytics: true}). But, unfortunately, after the SW be registered it didn't created an database for the workbox background sync, neither a table for the request (as seeing on this demo). On my application the SW is active and running but it doens't make requests, neither setup the indexDB. I'm using and local version of the gtag.js and it works as expected when the application is online, the events are logged on Analytics real time dashboard. But offline the requests aren't saved to be resent later. What I missed for this feature to work?
I recently used Google Domains to register a domain and have connected it to Google Cloud Console to manage a static website. I followed the Google Codelabs guide to set it up and faced no issues. However, when refreshing my website, it still doesn't load and my browser (Chrome) gives me the following error message:
This site can’t be reached
carbonfootprint.dev’s server IP address could not be found."
As well, going to www.carbonfootprint.dev gives me another error message:
Your connection is not private
Attackers might be trying to steal your information from www.carbonfootprint.dev (for example, passwords, messages, or credit cards).
NET::ERR_CERT_COMMON_NAME_INVALID
...Which is confusing, because I was under the impression that a .dev domain suffix gives SSL certification by default.
However, in my Google Domains settings, the website content appears as it should in the minimized preview that exists in both the Domain Overview panel and Website panel. It has been over 48 hours, so it should have updated by now if it were just a delay issue.
For reference, this is what my Custom resource records look like, this is what my synthetic records look like, and these are my bucket details in Google Cloud Console. As well, here is a preview of the website, as shown in the Google Domains console.
Any help is much appreciated!
Ended up finding the answer thanks to #IshRaj on ServerFault.
For future reference to anyone else viewing, Google Cloud Storage only supports HTTP connections when hosting a static website through CNAME resource records. To serve content through a custom domain over SSL, you will need to either:
Set up an external HTTPS load balancer (instructions here),
potentially with Google Cloud CDN (set-up documentation here)
Connect a third-party Content Delivery Network to your Google Cloud
Storage (guide here)
Host your static website on Google App Engine with Python (guide
here)
Serve static website content through Google Firebase rather than
Google Cloud Platform (tutorial here/additional support)
Personally, I went with Google Firebase (the last option), which automatically upgrades websites to https. It was simple and quick to set up and content is now directly deployable from my files. As well, with Firestore's automatic scalability and powerful queries, Firebase becomes a viable alternative, especially with its other features (user authentication, realtime data synchronization, machine-learning, extensions).
I copied the example given in Google Calendar API Quickstart and replaced it with the appropriate info. Every time I refresh the page, I'm asked to authorize before api data is fetched.
I'm using Chrome and I currently have multiple accounts / users. I noticed if I open an Incognito Window and sign in with one set of credentials then when I refresh the page I'm not asked to authorize.
Note, once I authenticate I receive calendar information so I don't believe it's an issue with client_id, api_key, scope, etc.
Looking at the example code, I'm guessing the getAuthInstance() is getting confused because of multiple accounts / users. Does anyone have any idea? Thanks!
This was happening when running on localhost. This issue stopped happening after deploying the webpage to a hosted server.
I am a developer of Codiva - java ide and online compiler. I am working on improving offline support, reducing network usage, reducing the latency by pre-caching as much as possible.
I want to know how to handle requests to google analytics.
First is the ga script. I use google tag manager to setup GA. Is it okay to cache that request, that is, can I use networkFirst strategy for this request? Or should it always be networkOnly?
How to make sure the actions that happened offline gets tracked correctly?
I am planning to start using Firebase for some featuers, firebase also has some kind of analytics. Would it automatically handle analytics when the device goes offline?
Use the Service Worker helper for Google Analytics:
https://developers.google.com/web/updates/2016/07/offline-google-analytics?hl=en
Try PWA Template https://github.com/StartPolymer/progressive-web-app-template
First is the ga script. I use google tag manager to setup GA. Is it okay to cache that request, that is, can I use networkFirst strategy for this request? Or should it always be networkOnly?
I'm not sure it's wise to cache the GTM script. The analytics.js script is relatively static, but the GTM script can be updated by anyone who has access to your GTM account. Changes made in there obviously wouldn't get propagated to users of the cached version of the script.
How to make sure the actions that happened offline gets tracked correctly?
The key is to use the qt parameter, which allows you to send a hit after the fact, and specify its time offset.
There's an unofficial service worker script that does this today that you should take a look at. It will probably become officially supported sometime soon:
https://gist.github.com/jeffposnick/466ef7578c4c880a78c7270e6ac69620
I am planning to start using Firebase for some featuers, firebase also has some kind of analytics. Would it automatically handle analytics when the device goes offline?
At this point Firebase analytics is mobile-only. If you're using their web SDK, I don't think you get any analytics at this point.
The Google Analytics Plugin for PhoneGap has an example app that contains the following code:
// Note: A request for permission is REQUIRED by google. You probably want to do this just once, though, and remember the answer for subsequent runs.
navigator.notification.confirm('GA_PLUGIN would like your permission to collect usage data. No personal or user identifiable data will be collected.', permissionCallback, 'Attention', 'Allow,Deny');
I've looked through the Google Analytics mobile SDK docs (although I have not read them start-to-finish) and have been unable to locate this requirement. I also don't see it in the Terms of Service at http://www.google.com/analytics/terms/us.html.
I don't mind requesting permission from the end user, but I certainly don't do it on web sites and I don't seem to recall getting many of these requests within apps that I've installed either.
Is the comment in the code correct?
Found it! Sort of. It's in the Measurement Protocol / SDK Policy doc. It states:
You will give your end users proper notice about the implementations and features of Google Analytics you use (e.g. notice about what data you will collect via Google Analytics, and whether this data can be connected to other data you have about the end user). You will either get consent from your end users, or provide them with the opportunity to opt-out from the implementations and features you use.
That's the Measurement Protocol / SDK Policy. It's not 100% clear to me that it refers to the iOS and Android SDKs. On the one hand, the table of contents type thing on the left has it under Measurement Protocol > Resources. The iOS and Android SDKs are outside of Measurement Protocol. So that suggests it doesn't apply to the iOS and Android SDKs. On the other hand, the Measurement Protocol doesn't seem to have an SDK associated with it, so that the suggests that "SDK" in the title may be referring to the iOS and Android SDKs.
I do wish this were clearer.