简体   繁体   中英

Google Analytics iOS SDK v2 - Custom dimensions

I've recently integrated the latest release of the Google Analytics SDK for iOS. I'm tracking screen views and trying to send custom variables along.

The only way I figured out I could use to do that is to use setCustom before sending the screen tracking request, like:

[[GAI sharedInstance].defaultTracker setCustom:1 dimension:@"dimension"];
[[GAI sharedInstance].defaultTracker trackView:@"To screen one"];

Using the debug mode, I managed to see the custom dimension sent over with the screen view request:

Body: cd2&ul=de&an=MyApp&_v=asldkajsdlkj3l12kj&cd1=dimension&t=appview&sd=24-bit&cd=To+screen+one&sr=320x480&tid=UA-XXXXXXX-X&v=1&av=alpha+6&qt=16921&z=1029348723498274

under the parameter "cd1".

The problem is: I can't see it anywhere in the dashboard. I've got all the screen views reported, but no custom dimension at all.

Does anyone have a glimpse of what the problem could be?

After asking in the Google Group , a guy named Dave pointed out the following:

Well, this document:
https://developers.google.com/analytics/devguides/collection/ios/v2/migration

says that custom variables aren't currently supported in the v2 SDK. Custom dimensions are supported, which is what your code above is trying to set. But, to use custom dimensions, this page:

https://developers.google.com/analytics/devguides/platform/features/customdimsmets

says that you need to first define them in the GA admin UI. To explain how to do that, the page links to this page:

http://support.google.com/analytics/bin/answer.py?hl=en&answer=2709829

and, unfortunately, those instructions don't match with reality. I don't have a "Custom Dimensions" tab under the "Custom Definitions" tab--I only have a "Custom Data Sources" one there. So something seems to be out of whack with the instructions or the GA admin UI at the moment--maybe there's beta flux, I don't know. I haven't found any way to define a custom dimension, and I think I've looked pretty much everywhere.

So, to answer your question: to use custom dimensions, you have to set those up in the GA admin UI before using them in your app. Currently, I don't see any way to do that, so I'm stuck on that step as well.

After contacting the support, looks like they fixed the problem and now it's possible to stup the custom dimenstions on the admin panel.

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