Is there any way to perform Server-side event tracking?
Every call to my Firebase function, has to go through multiple steps. I couldn't monitor it through console logs. Actually I need to prepare an report at end of every week and month.
Looking for the better way to do this. Is there any better tool available other than Google Analytics?
Appreciate your help!
As of late 2020 it is possible to log events from server-side code with the Analytics Data API and the GA4 Measurement Protocol documentation on sending events with this REST API, which you can use from Cloud Functions (and almost any other environment).
Old answer 👇
There is no server-side API for Google Analytics for Firebase.
Some options to consider:
Insert events directly from the clients that also trigger the Cloud Functions.
Use regular Google Analytics for these stats.
Insert the events into BigQuery and use Data Studio for reporting.
Related
Is there any way to perform Server-side event tracking?
Every call to my Firebase function, has to go through multiple steps. I couldn't monitor it through console logs. Actually I need to prepare an report at end of every week and month.
Looking for the better way to do this. Is there any better tool available other than Google Analytics?
Appreciate your help!
As of late 2020 it is possible to log events from server-side code with the Analytics Data API and the GA4 Measurement Protocol documentation on sending events with this REST API, which you can use from Cloud Functions (and almost any other environment).
Old answer 👇
There is no server-side API for Google Analytics for Firebase.
Some options to consider:
Insert events directly from the clients that also trigger the Cloud Functions.
Use regular Google Analytics for these stats.
Insert the events into BigQuery and use Data Studio for reporting.
I trying to find a better solution than google analytics to create dashboards for visually representing custom data.
My use case is that I need something to track and record custom data that is not passed in through custom web events into google analytics.
I was able to find a hacky solution to the problem initially by running a periodic function over my data on firebase and sending it as custom events to google-analytics. (I mention the approach in this answer. The linked blog post gives further details.)
The problem that I faced was that it wasn't always reliable as although the function did run successfully every day, the data was not shown in the google analytics dashboard.
The data I to visualize is gathered as further insights by writing basic code on existing data
I am aware that it is possible to integrate google analytics for various use cases like even the smallest button click, but I am trying to either send custom events( raised outside of the application by running cron jobs or scheduled functions ) through some API call or maybe directly save and update the data in some other place where there is direct access to visualization
Does anyone know a better solution?
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers, so you can use it to send your data generate outside your application:
https://developers.google.com/analytics/devguides/collection/protocol/v1
I am using Firebase for analytics and I have enabled firebase persistent storage which helps to send the analytics events to firebase when the device comes online but the limitation is it only sends 72 hours data to Firebase analytics.
I want firebase to get at least offline analytics data of the last 10 days.
Can I achieve this by storing this analytics event in core data when the device is offline and send this event to firebase when the device is connected to the internet?
Or is there any alternative way to achieve this?
I only want to send the event name and timestamp of the event.
You can probably do something to store the events locally, but it'll be finicky and error prone.
When storing the events yourself and then submitting them when the device is online, I see many potential problems. Off the top of my head:
There is no API to track the lifecycle of Firebase's built-in purging of analytics event. So you have a decent chance of events being logged twice.
You can't backdate the events, so any events you fire upon reconnecting are going to show up as having happened then.
You're likely going to miss events that Firebase logs automatically. You could probably compensate, but at that point you're almost building your own Analytics solution.
Honestly that is some of the potential problems, and you're likely to encounter many more. I'd seriously consider if the effort is really worth it, or if you'd be better off picking another solution.
Some solutions that come to mind:
Log your own events directly to BigQuery. Then merge then with Firebase's exported Analytics events, and deduplicate the results.
Pick an analytics provider whose API meets your requirements directly.
Is there any way to perform Server-side event tracking?
Every call to my Firebase function, has to go through multiple steps. I couldn't monitor it through console logs. Actually I need to prepare an report at end of every week and month.
Looking for the better way to do this. Is there any better tool available other than Google Analytics?
Appreciate your help!
As of late 2020 it is possible to log events from server-side code with the Analytics Data API and the GA4 Measurement Protocol documentation on sending events with this REST API, which you can use from Cloud Functions (and almost any other environment).
Old answer 👇
There is no server-side API for Google Analytics for Firebase.
Some options to consider:
Insert events directly from the clients that also trigger the Cloud Functions.
Use regular Google Analytics for these stats.
Insert the events into BigQuery and use Data Studio for reporting.
I need to test some things with a Google Analytics View, but the default demo account that Google offers does not allow user to use the Analytics Reporting API :
You cannot use the demo account with the Analytics Reporting API. Attempts to do so result in a permissions error: (403) insufficientPermissions.
Source
I just need to replicate a view with different data already.
Thanks for helping.
You cannot replicate views with data. A view will always start empty.
However you can simply register a Google Analytics account and send lots of bogus data (either by setting up a web page with tracking code and call it repeatedly, or set a cron job to fire call via the measurement protocol) (this will happen in realtime, so you need to wait a few days before you have enough useable data. There is not way to bulk-create hits for a longer timeframe).
If you just want to test the API it probably matter that much what data you use, so a mock account should work just fine.