AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2K members online now
2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Custom Dimension in iOS SDK v3

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭



I have a quick question about the developer's guide for measuring a custom dimension in the v3 of the iOS SDK.


The guide shows the following example:

// May return nil if a tracker has not yet been initialized with a property ID.
id tracker = [[GAI sharedInstance] defaultTracker];

// Set the custom dimension value on the tracker using its index.
[tracker set:[GAIFields customDimensionForIndex:1]
       value:@"Premium user"];

[tracker set:kGAIScreenName
       value:@"Home screen"];

// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once, so it is set on the Map,
// not the tracker.

// Previous V3 SDK versions.
// [tracker send:[[[GAIDictionaryBuilder createAppView] set:@"premium"
//                                                   forKey:[GAIFields customDimensionForIndex:1]] build]];

// // SDK Version 3.08 and up.
[tracker send:[[[GAIDictionaryBuilder createScreenView] set:@"premium"
                                                     forKey:[GAIFields customDimensionForIndex:1]] build]];

I can't understand why a value for the custom dimension is set twice, with different values ("Premium user" and "premium"). First the value is set on the tracker, but then when the hit is send, another value is set again.


I would be very grateful if some one could explain that to me.


Thanks in advance and best regards!