简体   繁体   中英

Not able to set custom dimensions in a google analytics property for android app

Please find the tracking code below,

GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
Tracker t = analytics.newTracker(MY_PROPERTY_ID);
t.send(new HitBuilders.AppViewBuilder().setCustomDimension(1, "testing custom dimension").build());

The above code is added to a click listener for an element in the UI.

Index 1 in setCustomDimension refers to a dimension named "test" in my property settings, which is the only dimension I have for that property.

The screen view session is getting tracked in 'App Overview', but is not added to the report for my custom dimension.

I created a custom report using customization tab. 报告我的自定义维度,

But still I am not getting any data for the custom dimension,

报告中未显示任何数据

I have checked the report after a day and even after running many times. I am using android studio and no errors/warnings are thrown in logcat.

Please help me to resolve this problem. And it would be helpful if you can suggest any clean documentation/blog with sample codes for tracking advanced metrics for an android app through google analytics.

Thanks in advance :).

I have the same problem, it seems there is a known issue in the SDK: https://code.google.com/p/analytics-issues/issues/detail?id=435 .

You have to set a screen name before sending the custom dimension to the tracker:

t.setScreenName("Home Screen");
t.send(new HitBuilders.AppViewBuilder().setCustomDimension(1, "testing custom dimension").build());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM