Reputation: 10785
I've been trying to find documentation about how to report programatically user-scope custom dimentions using google analytic android SDK.
so far the only document I see about this is this:
the sample code in this document is not make much sense, and seems like it's not target to java.
please help me understand how to do that using the analytics android SDK latest version.
TIA
Upvotes: 2
Views: 87
Reputation: 5168
Documentation for the Android SDK can be found here. Assuming you have correctly set up the user scoped custom dimension to be the first custom dimension, the following code will set and send the value:
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);
t.setScreen("Home Screen");
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once.
t.send(new HitBuilders.ScreenViewBuilder()
.setCustomDimension(1, "premiumUser")
.build()
);
Upvotes: 1