Closed indywidualny closed 8 years ago
The data is currently discarded, see #16
Doesn't a "download" require an active internet connection though?
While the sdk currently does not automate this, if you just want to track your own app installs, you could just check the connection yourself and if no internet connection is available, deferr the action.
Thanks. I'm actually counting my own app fresh installations and upgrades.
Checking an Internet connection state seems a great idea. I'm sending data about installations only so manual dispatching seems to be the best. Or setting a dispatch interval to 0 (I understand that if it's set to 0 it constantly tries to send data until there is a success, correct?).
However there is a slight modification to introduce in the sdk to make unique app downloads reliable. Just modify shared prefs after a successful dispatch when someone called trackAppDownload()
before. Not modify shared prefs at the moment the method is called :)
I don't think I'm able to do it in the near future but I'm thinking about serialization of data and simply saving data to a database. A dispatcher could send data directly from a database. This would make the sdk "app close proof". Any data would not be lost no matter what.
Thanks. I'm actually counting my own app fresh installations and upgrades.
So do I :). Also have some new ideas for that: https://github.com/piwik/piwik-sdk-android/pull/83
Or setting a dispatch interval to 0 (I understand that if it's set to 0 it constantly tries to send data until there is a success).
Please use Tracker.dispatch()
to force a dispatch outside the regular intervals.
However there is a slight modification to introduce in the sdk to make unique app downloads reliable. Just modify shared prefs after a successful dispatch when someone called trackAppDownload() before. Not modify shared prefs at the moment the method is called :)
That's not that trivial to do. Because dispatching is async, this needs to happen via callback, because we shouldn't block in "trackDownload". Introducing callbacks is a bad idea, because the mantra of the TrackMe objects is fire&forget. We would also need to syncronize trackDownload and the dispatch of the download information somehow, but we can't do that because it would block the dispatcher. The only sane solution here is via an offline mode, but that doesn't guarantee you "accurate" results either, because the user could clear the app cache.
I don't know how many downloads your app gets, but if you get in range of thousands or ten thousands, it doesn't really matter if a few installs are missed or are duplicate.
Still, the offline mode is something that needs to happen sooner or later :).
Ok. Thank you. So here is my plan. I will just disable auto dispatching (interval -1) and do Tracker.dispatch()
when I need to. I need it once so automatic dispatcher is not really useful for me.
I'm not sure how many downloads my app has because it's published on F-Droid and they disabled download stats a few months ago. I'm trying to find out, but it's actually no more than a few thousands imho :) Thanks again.
I'm using Piwik to count unique app instalations. I was looking through the code and I couldn't find a very important thing.
What happens when the data cannot be dispatched and the user closes the app? Is the data somehow stored until next run in order to try to send it again later?
I wanted to use it as the reliable download counter but I cannot find serialization of not send data anywhere.
So please explain me what happens when the app is closed before the data is dispatched. Will the app try to send data again when it's run later? Or if dispatching fails and the app is terminated the data is just lost. It's very important to me.
I'm using a default dispatch interval (120s) so it's possible that the app gets closed before the first dispatcher run.