mufc
mufc

Reputation: 715

Screen Tracking not showing up on Google Analytics iOS

I have an app where I am trying to track screens with Google analytics.

I have set everything up in the delegate, and tried to automatically track three screens. Out of the three screens, only 1 of them is automatically tracking, the other two I had to track manually. I do not understand why this is the case, but I've tried looking for solutions and answers but none have come up.

The one class where the automatic screen tracking worked in in my SettingsViewController

in SettingsViewController.h I import "GAITrackedViewController.h"

and in SettingsViewController.m I do the following:

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    self.screenName = @"Settings";//GOOGLE ANALYTICS WAS IN ViewWillDisappear
    //rest of code

}

This works because in Google Analytics, I can see all the times that I've seen this view and I have all the tracking data necessary.

It gets annoying in my other two classes where I tried the EXACT SAME THING and did no get the same results.

In both my FriendView and HomeView I tried doing the automatic screen tracking, but that did not work in either view, so I tried implementing the manual screen tracking.

In both my HomeView and FriendView I do the following:

#import "GAI.h"
#import "GAIFields.h"
#import "GAIDictionaryBuilder.h"
#import "GAITrackedViewController.h" //Import from when I tried automatic screen tracking

and then I do

-(void)viewDidAppear:(BOOL)animated{

    //self.screenName = @"Friends";//GOOGLE ANALYTICS

    [super viewWillAppear:animated];

    id tracker = [[GAI sharedInstance] defaultTracker];
    [tracker set:kGAIScreenName
           value:@"Friends"];

    [tracker send:[[GAIDictionaryBuilder createAppView] build]];

}

The manual tracking works better because I can see it under real time screen tracking. But for some reason I still cannot see FriendView or HomeView screen tracking under Behavior/ Screens in Google Analytics. The only data I have is from the SettingsView.

I would much rather use the automatic screen tracking because it is less code, but I have tried this solution and various others to try and get automatic screen tracking to work, and to be visible in Google analytics but it just does not.

To be clear, in both cases, the data does not show up in my screen tracking data. Only my settingsView data is visible and sending. The only difference is that when I do the manual screen tracking I can see the data come in real time, but it still does not show up in the general screen data view.

I am using v 3.0.7 in my app.

Thank you in advance for any solutions.

Upvotes: 5

Views: 3579

Answers (3)

shubham mishra
shubham mishra

Reputation: 991

Everything is perfectly fine only the section in which you are searching the screen is wrong. So go to > Reporting > Real Time > Screens to view you screen or else try to search SCREEN in the search box and that will give you various options then try them one by one to get the correct option.

enter image description here

Upvotes: 1

Bao Lei
Bao Lei

Reputation: 3615

I also tried all different ways to track screen views in GA (manual vs auto, createAppView vs createScreenView, in viewDidAppear vs in viewWillAppear, etc) and for a long time I thought they weren't working. I also turned on verbose debug mode and everything seems correct (returning 200, screen name being logged as I expected). Later I realized that they were actually recorded, I was just looking at the wrong place in GA website.

They are not in Site Content/All Pages, and they are not in Behavior Flow, or Events/Pages. But if you select anything like an event, and select "Screen Name" as a primary or secondary dimension, then you can see all of them. Or you can create a customized report and directly display screen name.

I'm surprise that screen views are so hard to find in the GA web interface. I hope that Google can make a change to treat the screen views like web's pages, and be able to see a flow chart of the transitions.

EDIT:

Then I realized that it's because I'm posting all the data into a view that's configured for website, not for mobile app. (Initially we wanted to track app and web in the same view.) When I created a new GA view for mobile only, everything makes sense now.

Upvotes: 3

Nitin
Nitin

Reputation: 1543

To automatically measure views in your app, have your view controllers extend GAITrackedViewController. Set a property called screenName with the name of the screen that you want to appear in your reporting.

For example, suppose you have a “Home Screen” view that you want to measure with a view controller header that looks like this:

@interface HomeViewController : UIViewController

You would update this header to:

#import "GAITrackedViewController.h"

@interface HomeViewController : GAITrackedViewController

You must also provide the view name to be used in your Google Analytics reports. A good place to put this is the view controller's initializer method, if you have one, or the viewWillAppear: method:

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  self.screenName = @"Home Screen";

}

For more information Please go through this link Google Analytics

the whole code is look like this enter image description here

Upvotes: 0

Related Questions