1
votes

I'm integrating Google Analytics for iOS into my iPhone app.

The main part of my app consists of a user swiping through a bunch of travel highlights (using a UIPageViewController).

In the UIViewControllers (inherit from GAITrackedViewController) that get fed to the UIPVC, I set the screenName and set values for custom dimensions:

// viewDidLoad
self.screenName = @"Highlight Detail";

// viewDidAppear
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:[GAIFields customDimensionForIndex:1] value:self.highlight.city];

GA is accurately counting each swipe as a separate screen view, but it's counting all of my swipes as just one unique screen view.

What do I need to do so that every time my UIPageViewController loads a UIViewController, GA marks that as a unique screen view. If the user navigates back to a screen that has already been loaded, I'm ok with that not counting as unique, but if it's their first time browsing to a particular travel highlight screen, I want it to count as unique.

2

2 Answers

0
votes

Found it - you can manually send screens like this :

id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName
       value:screenName];
0
votes

You can try this:

// May return nil if a tracker has not already been initialized with a property

// ID.

id<GAITracker> = [[GAI sharedInstance] defaultTracker];

[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action"
                                                      action:@"button_press"                                                       label:@"play" value:nil] build]];

Please check out this: https://developers.google.com/analytics/devguides/collection/ios/v3/events

You need to think for applying logic lets say you will give unique event names every time. I mean to say instead of using screenName, you can try events.

Hope, It will may help you,

:)