Firebase Analytics for android has a metadata for the manifest to disable data collection before the user's consent
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
To re-enable collection, such as after an end-user provides consent there is the method
setAnalyticsCollectionEnabled(true);
To limit only the collection of the advertising id there is the metadata to add to the manifest
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
Then, to rehabilitate the collection of the advertising id, after the user's consent is there a dedicated method? Or is it okay to continue to use setAnalyticsCollectionEnabled(true);
setAnalyticsCollectionEnabled(true) doesn't influence setting google_analytics_adid_collection_enabled. Once you disable advertising id collection in the manifest file, there is no way to enable it programatically.
Related
In my app I had Google analytics off with
<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="false" />
However I had totally forgot about that, and I have showed the users a banner for granting or declining google analytics tracking and then setting the dataCollection accordingly
firebaseAnalytics.setAnalyticsCollectionEnabled(userPref);
My question is, now tha I will set manifest to
<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="false" />
<meta-data android:name="firebase_analytics_collection_enabled"
android:value="false" />
will the users' permission be retained ? meaning if the user had accepted tracking (while analytics were permanently closed) will now be tracked? or should I question for their consent again ?
Ok I have tested it and apparently the state of
firebase_analytics_collection_enabled
is respected even with
<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="false" />
I'm just posting it here just in case it helps someone in my position
Accordingly to this you have to ask consent only once. If you want your users to be able to revoke their consent - you have to create a possibility for them to make it explicitly - inform them how and where to do that. After the users have revoked their consent - you would have to ask them once more.
Thus if your users have already given their consent it works all the time for the scope you've described in a disclosure message. If you want to change the scope of features that require user consent - you have to ask for users' consent once more - but only for the new features.
Also, as far as I understand(I am not sure though - I haven't found definite info about that), consent works only for one installation though - after reinstalling the app, the disclosure should be shown once more for the user.
The data stored is persistent though - almost indefinitely.
from Configure Analytics Data Collection and Usage:
In some cases, you may wish to temporarily or permanently disable
collection of Analytics data, such as to collect end-user consent or
to fulfill legal obligations. Google Analytics offers multiple options
for disabling and deactivating Analytics collection. Used together,
they support many typical use cases.
Temporarily disable collection: If you wish to temporarily disable
Analytics collection, such as to get end-user consent before
collecting data, you can set the value of
firebase_analytics_collection_enabled to false in your app's
AndroidManifest.xml in the application tag.
Does it mean that if I want to disable data collection and ad ID featues I need to add
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="false" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
to every AndroidManifest.xml file? Including the one in my library (com.android.library) module?
I use a library for my app which takes Google Advertising Id for some reason.
This will violate the Android Advertising Id policy.
My question is if I disable taking this id using the firebase metadata tag (ignoring what will happen to the library), am I still violating that policy?
The tag, according to firebase doc is:
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false" />
I mean how google detects that using getAdvertisingId method is violating?
With Firebase Analytics, is it possible to configure it so that a user can set a preference and opt-out of being tracked?
You can default Firebase Analytics to disabled by adding the following meta-data to the application element in your AndroidManifest.xml:
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
To enable Firebase Analytics per individual instance you can then call:
FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(true);
Once you make the call the value is persisted on the device and will remain in effect until you make another call to setAnalyticsCollectionEnabled. Once set the value has effect on all events logged after the call from any process or thread on the device. If your app is using multiple processes you only need to make the call once. More details in official guide.
The support page shows how you can temporarily disable Analytics collection, such as to get end-user consent before collecting data.
I'm new to this GA thing, and the guide on the official website (https://developers.google.com/analytics/devguides/collection/android/v4/) is not really clear to me.
For my first app I want some simple statistics: when people install the app or delete it, do they return to it after installing.
Also I'd like to make several apk's (not only for Google Play, but also for third-party websites) and see stats for each app (I've heard you can add some kind of markers for that).
I have the required permissions in my manifest:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
I also have a global_tracker.xml but it's not yet functional:
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes">
<integer name="ga_sessionTimeout">300</integer>
<!-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>
<!-- The screen names that will appear in reports -->
<!-- The following value should be replaced with correct property id. -->
<string name="ga_trackingId">UA-hidden-2</string>
What else do I need to add and where? Is there some better guide rather that the one I linked above?
To track installations on Android you need to enable campaign tracking by registering CampaignTrackingService and CampaignTrackingReceiver in your ApplicationManifest.xml:
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
To also track applications referring your application (like browser link launching your application) you will also need to either enable automatic activity tracking with a call to tracker.enableAutoActivityTracking(true) or manually call tracker.setCampaignParamsOnNextHit(activity.getIntent.getData(). If you expect your app will run on Android API 11 or earlier (this is Android 3.0 Honeycomb) you also need to manually call analytics.reportActivityStart(this) from each Activity.onStart() and analytics.reportActivityStop(this) from each Activity.onStop() of your application activities.
Web sites don't actually distribute your app. They only link to Google Play store entry. You need to provide the web site with the URL to install your application. The URL you provide must include "referrer" parameter with your campaign parameters.
There is detailed campaign tracking devguide on Google Analytics developer site: https://developers.google.com/analytics/devguides/collection/android/v4/campaigns
There is URL builder at the end of the devguide that you can use to generate your download URL.