Getting programmatic access to Firebase Analytics trending events - firebase

I have a mobile app which plays audio tracks. It uses Firebase Analytics to record events such as 'track names' played. Within the Firebase 'StreamView' one can access trending events and see which are the most popular tracks being played at any given moment. I would like to gain access to this list to and use it within my app to display a list of "tracks being played now".
I've looked into gaining access to Analytic trending event data and think Firebase Cloud Functions may provide a method of extracting the information I need. However, I'm not certain this is the correct, or easiest, method.
Could someone let me know whether extracting trending events is possible and, if so, point me in the correct direction?
Thanks

EDIT - Actually, there is a much better and easier way to get access to real-time events that have occurred in your app over the last 30 minutes. You can do so using the Google Analytics Data API.
Using the API you can filter through the event data for the past 30 mins, and inspect relevant custom dimensions on the play_track event for the track that was played (or provide a custom dimension filter to further specify the event data you get back).
This would be the ideal way to achieve what you're looking for. You might still want to use Cloud Firestore if you'd like to keep a longer record of trending tracks being played (e.g. in the last hour, last 24 hours, etc... though). Also note that the API is still in alpha.
-- END OF EDIT
Other Solutions
Option 1 - Use Cloud Firestore
This is probably the easiest solution - you can create a record of which tracks are being played whenever the event occurs by creating a simple collection in Cloud Firestore, and updating records for tracks being played there. It would require additional effort in logging and retrieving which tracks are played beyond just using Google Analytics, but should be straightforward to implement.
Note you'll probably want to check out the Firestore pricing guide first before selecting this option.
Option 2 - Using Firebase Cloud Functions
You can trigger a Cloud Function each time a play_track event is logged. The event will need to be marked as a conversion event in order for it to trigger a Cloud Function, and within the Cloud Function you can access the event parameters to identify which track is being played, and over time maintain a record somewhere for which tracks are being played to determine the most trending tracks. To maintain state you could use something like Firestore to keep track of which "tracks" are being played at the moment.
A couple of caveats about this approach:
You'll want to check out the Cloud Functions for Firebase pricing guide to make sure it falls within an acceptable range for your needs.
Cloud Functions triggers for analytics events currently only works for Android and iOS apps (no support for web apps).
Google Analytics triggers for Cloud Functions is currently in beta.
Option 3 - Using BigQuery for your analytics data
This option requires a bit more effort to setup, but you can export your Google Analytics data to BigQuery, and query the generated intraday tables to see which tracks are trending as well as a lot more additional insights.
The caveat with this approach are that you'll also need to check the pricing guide for using BigQuery to make sure it falls within your needs, and you'll need to make a call to execute the query and retrieve the list of tracks (or get a cached result).

Related

Events from Firebase Analytics don't showing up in Big Query

I have a trouble when I linked Firebase Events to Big Query.
In Firebase Analytics, I have many event .
I linked firebase with Big Query
But in Big Query, I can't see it.
How can I see it?
I tried to unlink bigquery and put it back. I tried to follow every tutorial, but there is nothing to do, my events don't appear and I don't know why
my 25 events in firebase
events that I apparently export from firebase, but they have nothing to do with those in firebase
So If somebody knows how to realy export their events from firebase it would be a pleasure :)
PS : sorry for my english, I hope I don't made too much wording mistakes
It appears that data from Firebase is exported to BigQuery when it is beyond a certain number as you can see only screenView event is getting recorded in Big Query which has a high number of event count. It takes some time for the data to accumulate and get displayed as it is not recorded in real time as Firebase. If the linking has been done properly then the data will start to show up as soon as it is beyond that number.
Analytics events are exported from Firebase to BigQuery from the moment you enable the integration. There is no way to export events from before you enabled the integration.

Firebase + BigQuery - Uniquely Identifying Devices

Recently started exploring the Firebase data via the Data Studio Firebase connector. I'm doing some custom reports based on the user_engagement event to compare with data we previously reported on in Flurry.
When looking at some DAU figures they are pretty close but on MAU they tend to get inflated. (Saw this behavior first on the Firebase Events Report Template). Digging into it a little more we do have a pattern where users frequently reinstall the app which generates a new app_instance_id. So as I fallback I'm using the resettable_device_id but then there's the situation advertising tracking is disabled on device resulting in a zeroed value. (Or for a brief period in January nulled out values, not sure if this was client or part of the Firebase link)
Currently thinking something roughly following the logic below, falling back to app_instance_id if the advertising identifier was not set. What approaches would be worth looking into to have a reliable user identifier for metrics reporting? (In future will be calling the setUserID to utilize our own identifier but looking to match up historical data)
IF(user_dim.device_info.resettable_device_id is not null,
IF(user_dim.device_info.resettable_device_id = '00000000-0000-0000-0000-000000000000', user_dim.app_info.app_instance_id, user_dim.device_info.resettable_device_id),
user_dim.app_info.app_instance_id
) as unique_user_identifier,
Thanks in advance.
Simpler way to deal with the cases where a resettable_device_id is not available:
IF(user_dim.device_info.limited_ad_tracking, user_dim.app_info.app_instance_id, user_dim.device_info.resettable_device_id) as unique_user_identifier

How to delete an Analytics Event from Firebase

How can I delete an Analytics Event from Firebase?
While I am testing I wrote some events in Firebase Analytics. Firebase by default orders all events alphabetically. So these testing events interrupts with original events.
I could arrange them by count to push all the testing events to last. But it makes difficult to find the main events since those are not alphabetically sorted.
I didn't find any options in Firebase dashboard to delete a event. Is there a way to delete the old events from firebase?
There is currently no way to delete events once they are logged into Firebase Analytics that I am aware of. However, the events will drift out of the default view (which is set to "last 30 days") as time goes on, or you can switch the time period to a shorter time. As you mentioned, you can also click a column header to sort by some other value or "add filter" to filter by an audience or user property.
You can create a new Firebase project if you want to start from scratch. It's also a fairly common practice to use one project for experimentation and validation of your analytics implementation and then to switch to your production Firebase project when everything looks good.
It is not possible to delete analytics events AFAIK, but on some views you can set up the time interval with the filter at the right-top corner to limit the listed events. In the audience set up you need to rely on typing, I am afraid.
As of 31 May 2018, there is an API for this. Doesn't delete individual events, but you should be able to use it to delete all the events collected by a particular app instance:
User Deletion API v3 (UserDeletion.userDeletionRequest)
It was introduced in this blog post and the intended purpose (user privacy) is described here (last paragraph).
Unfortunately, based on my own question, no one seems to have figured out how to get it to work :(
EDIT
Turns out that, according to Google, this API does delete events (which technically is what the OP was asking), but since the aggregate total remains visible on the Firebase console, it won't help with the OP's specific use case.
As Steve Ganem suggested the simplest thing you can do to reset the Firebase Analytics data is to register new Firebase project and that in your app. You can also keep the old project around for debugging/development.

enabling hourly data in google analytics

I have two view/profiles linked to my google analytics account. I want to fetch the hourly data for the current day, ie
start date:today
end date: today
with a few filters and dimensions.
Now I am getting the response for one view that means it is possible in google analytics, however for the other view its showing all the values as 0- this applies both to the gui and the api.
Can anyone suggest me how to enable it for the other view as well?
You cannot. Google Analytics needs some processing time. It might be that some data appears immediately, especially on small accounts, but it's not guaranteed and not a thing you can "enable" or count on.
Updated: Okay, that was a dumb answer. Still, there is a processing latency event in GA Premium. It is possible to get realtime data, but that's a different API with limited data (the core reporting API might return data, but no guarantees for that).
But I admit, since your problem is that you do not get data for the whole day yor have a different problem. But with a premium account you should be able to contact your account manager/technical support.

Querying Event Flow with Google Analytics API?

Using: Universal Analytics (analytics.js)
I am currently testing user experience across a site by triggering different events upon pageView. On a given pageView, multiple events may be triggered.
I am interested in determining what events (or sequence of events) may lead to a conversion being triggered. In the frontend, this can be achieved via Event Flow or Goal Flow visualizations. Unfortunately I could find nothing online regarding querying Event Flow specifically.
Is it possible to query Event Flow from the Google Analytics API? If not, are there any workarounds that would allow us to quantify impact from different flows?
There isnt a way of doing it with the API. I want to start by saying i havent tried doing this I am just going on what i would do if i did want to attempt to do this.
The flow apears to start with any of the normal dimensions country for example. My first idea was the ga:goalpreviousstep1 dimensiosn then i remembered they cant be queried with other dimensions.
I would look into ga:previousPagePath and ga:nextPagePath see what they come back with. queried along with your goal or event they might give you an idea of what the user was doing.

Resources