Use existing data streams to segment data from each individual app - firebase

From the old version of analytics I have 1 property with many data streams.
Each data stream represents 1 Android app.
The reports are not relevant as they aggregate all data streams with no way to segment each individual app.
How can I get a separate reporting for each app using the same data streams i.s. WITHOUT creating new firebase config files.
I have already tried to create a new property but when adding the datastream, there is no way to use an existing one.

Just found out a way to get what I need:
In a new report, click All users, then the Audience Name should be Stream ID and then the Dimension Value should be the app you want the report from.

Related

Sending message to Pub/Sub when data is ingested to BigQuery or Google Sheet

For a project I need to apply some functions to data that is added to a Google Sheets or Google BigQuery table using Pub/Sub.
I want to pass the newly added table rows to listeners that are subscribed to the Pub/Sub topic. Essentially, the table contains some links with images from external websites and I want to automatically download them, store them in our google cloud storage bucket and add a link to the new location of the image to the original table. This is supposed to happen immediately after the data is received.
I cannot figure out how to publish a message that contains the new data to my PubSub topic once data is appended to my tables.
Does anyone know if what I am trying to achieve is even possible?

Change default data collected by Firebase/Google analytics

We use Firebase/Google analytics in our android app. Each event is saved with a lot of extra information (user-id, device-info, timestamps, user-properties, geographical location …). The extra info is there by default but we don’t want it to be collected.
We tried 2 things:
1) Update Big Query Schema
Delete the unwanted columns from Big Query. Unfortunately, Big Query creates a new export every day. So we would need to know where those fields are coming from. Something we don't know.
2) DefaultParameters within the app
Tried to use default parameters from inside the app, so the city will always be null. Here is an example with the user’s city
Bundle defaultValues = new Bundle();
defaultValues.putString("geo.city", null);
FirebaseAnalytics.getInstance(ctx).setDefaultEventParameters(defaultValues);
Unfortunately, we still see geo.city in our BigQuery data filled in.
Is there a way of changing what is collected by default?
There is no way to disable the geography information. Analytics uses IP addresses to derive the geolocation of a visitor. Probably the solution about update Big Query Schema is a viable way. You have to create a system that carries out this update on a daily basis precisely because the export takes place every day.

Merging datasets in Bigquery

After upgrading to Google Analytics in my Firebase project I linked up to a new GA property and had to re-setup my Bigquery integration (after accidentally linking/unlinking my GA account, my integration was turned off). I got it fixed by linking again but now all new data is fed into a new analytics_* dataset.
Since all my queries are referring to the old dataset it would be quite the effort renaming all of them to link to both the new dataset + the old dataset. Is it possible to either:
Change the destination table in the firebase Bigquery export (choosing the old dataset instead of the newly created one)
Somehow merge the two datasets (instead of copying them)
I understood it's impossible to rename datasets which would solve my issue if I could change the name of the new set to the old name and copy the contents of the old set to the new one.
UPDATE
I was able to fix it by:
unlinking the project again
using the firebase management api to link my firebase project again to the original GA property
https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/addGoogleAnalytics#request-body
This started feeding data back into my old property. I subsequently copied the partitioned tables from the newly created property/ table back into the old property (in Bigquery) using the same naming convention (eg. events_20190101) which correctly copied them in the partitioned dataset. I had to append some intraday events as well to the existing partitioned dataset but this solved my problem in the end.
According to the BigQuery export schema document for each single Firebase project linked to BigQuery, a single dataset named "analytics_" is added to your Bigquery project and such ID refers to your Analytics Property ID located in the Analytics Settings in Firebase (Settings -> Integrations -> Google Analytics).
It seems that this ID is generated automatically when you set up a property and it can be manually changed to a custom one.
Additionally, there's no way to merge datasets than copy the data between them. Thus, you could consider using scheduled queries to append the data in your old dataset.
Hope it helps

Firebase Database concurrent data writing

For writing data in Firebase Database I use setValue() in my android app.
My question is: can a value of a variable change, if at the same time I change the value using the Admin API?
All writes to the database from all clients are ordered. It doesn't matter if its from a client app or the admin SDK. If there are two database clients trying to write different values to the same location in the database, the last writer in the order overwrites the previous value, which is then what all the other clients will eventually see.
If you want to decide what to do in the event of a conflict like this, you can use a transaction to make sure that each client gets to know exactly what the prior data was, and what the new data will be. This is how you make things like a counter safe to increment when there are lots of writers trying to increment it.

How to dynamically add index on the server side in firebase?

Lets say I'm making an app with firebase where the user can create permanent lobbies in which they can send permanent dated messages to. The lobby's name is a key in my data structure. What I want to do is that each time a new lobby is created, an index is automatically created on the server side to sort the messages of that lobby by date.
That can probably be done if I have another server listening in to the creation of new lobbies but is there a way to do this without having an additional server? Just through the client? Without compromising the security of the app?
(Note: I'm using the Unity sdk)
There is no way to programmatically add an index, short from updating a rules.json file and uploading it with the Firebase tools/CLI, which I'd highly recommend against.
If you find you need to dynamically add indexes, you've probably structured your data wrong. But without seeing a minimal sample of the JSON (as text, no screenshots please) that reproduces the problem, it is impossible to say more than that.
You can use the Push() function on a database reference. This will create a unique key based on the timestamp so all values can easily be sorted chronologically.
Use Push() anytime you need to generate a new unique key on your database. You can use this for the lobby itself and even the conversations within the lobby.
Source

Resources