Hi
So, I’m not sure if this is the right place for this, but I’m new here, so sorry if I’m wrong or if I use expressions wrongly.
We are currently looking for tools to gather analytics data from our customers for our next project (which will be a Unity game).
We also want to gather data to provide statistics to the player.
I stumbled upon Realm while looking for tools to do this and I thought I can use it for both. But I’m not sure if I got some things right.
So here are a few questions I stumbled upon while I built it into our current project to get a feel for it:
Turn off data collection by switching Realm configuration:
Our players must be able to turn off the collection of analytics data at any time.
My first approach was to switch the Realm configuration to a local Realm after a player turned off data collection.
Then, when a player enables data collection again, I would switch the configuration back to Sync.
When I do that, I get the following error:
RealmException: History type (as specified by the Replication implementation passed to the DB constructor) was not consistent across the session
I guess this happens because the Realm was once synced and can’t be used as a local Realm now?
I would use Flexible Sync for this approach because we don’t want to collect all the data we gather to display the statistics.
Is this a practical approach?
Or does the next approach make more sense?
Turn off data collection by using two different Realms:
My second approach is, to use two different Realms.
One local Realm for gathering statistic data to display to the player and one synced Realm to gather analytics data.
When the player chooses to turn data collection off, I can simply stop to gather data with the synced Realm and log out from the sync session.
I would use Partition Sync for this approach because I can simply sync all the data in the analytics Realm.
The downside of this approach is that some data is duplicated.
For example, in our current project, a duplicate dataset would be how many settlers a player had in the last few in-game years.
But I guess the positives outweigh the negatives with this approach, right?
General data collection
For data collection, I’m thinking about a pull approach, rather than a push approach.
So, rather than pushing data from different parts of the game to the Realm managing part of the game and writing them to the Realm, we want to collect data at fixed time intervals and then write them to the Realm in one go. This would probably happen asynchronously.
As I understand it, the recommended approach is to write as much data as possible in one Write call to the Realm, rather than having many Write calls, right?
Device Sync User
As we don’t want to log in any of our users by e-mail and password, I log in every user as an anonymous user.
Is this the right approach?
Or should we rather not do that?