问题
I am integrating Firebase analytics in my android app but I cant see in documentation or google how I can add a test device so It doesn't count on stats.
I test a lot, so my main stats will be corrupted if it counts my own events
In admob I do
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("70A9E11F73EREFF712A1B73AE2BC2945")
.addTestDevice("1D18F0345E4C90E3625DB344BE64D02E")
.build();
回答1:
I solved it with a new audience in Firebase Console with filter:
User Properties / App Store + "does not contain" + "manual_install"
I figured it out that all direct app installs and also all Firebase Test Lab installs falls into this parameter.
If you want to remove only a few users then you could add this filter (haven't tried it):
User Properties / User ID + "not equal to" (or "does not contain") + your_ID
This only works in Firebase Analytics and only with events that happened after audience was created.
For BigQuery I use the following query to exclude the testing devices:
SELECT
user_dim.user_id AS userId,
FORMAT_UTC_USEC(user_dim.first_open_timestamp_micros) AS tsFirstOpen,
user_dim.device_info.device_category AS dCaterogy,
user_dim.device_info.mobile_brand_name AS dBrand,
user_dim.device_info.device_model AS dModel2,
user_dim.device_info.platform_version AS dOSver,
user_dim.device_info.user_default_language AS dDefLanguage,
user_dim.geo_info.continent AS geoCont,
user_dim.geo_info.country AS geoCounty,
user_dim.app_info.app_version AS appVer,
FROM
TABLE_DATE_RANGE(YOUR_TABLE_NAME.app_events_, TIMESTAMP('2016-06-23'), TIMESTAMP('2016-10-01'))
WHERE
// Remove all testing devices
NOT (user_dim.user_id == "YOUR_USER_ID" OR
user_dim.user_id == "YOUR_USER_ID") AND
NOT user_dim.app_info.app_store == "manual_install" AND
user_dim.user_properties.key == "first_open_time"
GROUP BY
tsFirstOpen,
userId,
dCaterogy,
dBrand,
dModel2,
dOSver,
dDefLanguage,
geoCont,
geoCounty,
appVer
ORDER BY
appVer DESC,
tsFirstOpen DESC
回答2:
You can add device with adb command:
adb shell setprop debug.firebase.analytics.app packageName
来源:https://stackoverflow.com/questions/38631533/how-to-add-an-android-test-device-to-firebase