Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Google Analytics custom dimensions for Android

My application has a single instance of Android.Gms.Analytics.Tracker that I'd like to set some custom dimensions on.

The way to do this in Java is as follows:

tracker.set(Fields.customDimension(1), "value");

The way to do it in Xamarin.iOS is:

tracker.Set(Fields.CustomDimension(1), "value");

but I cannot find a way to do the same thing in Xamarin.Android. The Set method that is available on Android.Gms.Analytics.Tracker seems to be the one intended for this purpose, but I can't find the Fields object that is available in iOS, and no matter how I format the key string for the first argument of Set, nothing shows up in my Google Analytics console. I've tried all of these formats:

Set("1", "value");
Set("dimension1", "value");
Set("Dimension1", "value");
Set("dimension 1", "value");
Set("Dimension 1", "value");
Set("DimensionName", "value");
Set("dimensionname", "value");
Set("customDimensionForIndex1", "value");
Set("customDimension(1)", "value");
Set("(1)", "value");

without success. There doesn't seem to be any documentation or code samples available for this either. Has anyone managed to get this working before? Could someone from Xamarin comment on the correct usage of Set?

Best Answers


Sign In or Register to comment.