Context
I’ve been working with Google Analytics in my Android app for a while now, but I’m looking into switching to Firebase Analytics since it seems to be the newer approach that Google is pushing.
My confusion
I’m running into several issues while trying to figure out how to make this transition properly. Here are the main things I can’t figure out:
Property ID Setup: In the old system, I had to use a property ID with the tracker creation method. I don’t see this requirement anymore. Is it handled automatically now?
Ad Tracking: There used to be a method called “enableAdvertisingIdCollection” for gathering advertising data. I can’t locate this in the new API. Does it collect this information by default?
Debug Mode: The old “setDryRun” method let me prevent data from being sent to servers during testing. I don’t see this option now. Is debug mode automatic for development builds?
Screen Tracking: Previously I tracked screens manually like this:
public void recordScreen(String screenName) {
analyticsTracker.setScreenName(screenName);
analyticsTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
Does Firebase Analytics handle screen tracking automatically through activity lifecycle?
Event Tracking: This is my biggest question. I used to track events with category, action, label and value:
public void recordUserAction(final String category, final String action, final String label, final long value) {
analyticsTracker.send(new HitBuilders.EventBuilder()
.setCategory(category).setAction(action)
.setLabel(label).setValue(value).build());
}
Now I see it uses bundles instead:
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_ID, itemId);
params.putString(FirebaseAnalytics.Param.ITEM_NAME, itemName);
params.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "video");
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, params);
How should I map my old tracking structure to this new bundle system?
Any help would be great since I’m pretty confused about making this switch.