UPDATE -- Google Analytics SDK for iOS v3
So I'm using v3, and there is not any problem:
I'm implemented it in the AppDelegate. In .h file:
#import "GAI.h"
@property (nonatomic,assign) id<GAITracker> tracker; // I'm not using ARC (assign)
.m:
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
// GOOGLE ANALYTICS
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 0;
tracker = [[GAI sharedInstance] trackerWithTrackingId:@"yourGAID"];
And write a method like this:
- (void) sendGoogleAnalyticsView:(NSString*)viewName{
[tracker set:kGAIScreenName value:viewName];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
[[GAI sharedInstance] dispatch]; // this will force track your views.
}
Old answer:
See this answer below this link, if you do it the same as I told in this answer it must work
Another stack-overflow answered question about google-analytics
and use these methods:
[GAI sharedInstance].optOut = YES;
[GAI sharedInstance].dispatchInterval = 0;
[GAI sharedInstance].trackUncaughtExceptions = YES;
tracker = [[GAI sharedInstance] trackerWithTrackingId:@"YOUR TRACKERID"];
[tracker sendView:@"Your View name"];
[tracker sendEventWithCategory:@"YOUR CATEGORY" withAction:@"YOUR ACTION" withLabel:nil withValue:nil];
Download GoogleAnalyticsiOS_2.0beta4.zip from this link this will contain those classes what you need, and it will work perfectly. Be careful, google analytics got a lead time, to show you information, about real time. And not real time datas will show only a day after
EDIT for 3.0:
I found some probably useful things for you:
We have just come across this issue and this is slightly out of date
so here is an updated answer. The issue we were having after following
the instructions on the Google Analytics website, they instruct you to
add the following files GAI.h
, GAIDictionaryBuilder.h
, GAILogger.h
,
GAITrackedViewController.h
, GAITracker.h
and
libGoogleAnalytics_debug.a
library. What they completely forget to
include on the website instructions is the one where you have to
include libGoogleAnalyticsServices.a
library. This is included in the
zipped download but there is no instructions to indicate to include
this in the debug version.
Note : In the readme.txt libGoogleAnalyticsServices.a
is just referred
to as libGoogleAnalytics.a
Google have failed to update their
documentation to include the new name or the correct instructions that
indicate this is required in debug.
Files and Libraries that most be included
GAI.h
GAIDictionaryBuilder.h
GAIFields.h
GAILogger.h
GAITrackedViewController.h
GAITracker.h
libGoogleAnalytics.a // Also know as libGoogleAnalyticsServices.a
libGoogleAnalytics_debug.a

plus information:
I'm pretty sure google has not yet provided a arm64 version of their
libGoogleAnalyticsServices.a
, which is really annoying ...it has
been weeks since the public the release of Xcode 5GM.
For now, I guess only build for armv7, armv7s or remove google
analytics until they get their head out of their pants.
Here is a iOS Getting Started Guide. for implement it.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Optional: automatically send uncaught exceptions to Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;
// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 0;
// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
// Initialize tracker.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Y"];
}
To manually send a screen view, set the screen field values on the tracker, then send the hit:
// May return nil if a tracker has not already been initialized with a
// property ID.
id tracker = [[GAI sharedInstance] defaultTracker];
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to nil.
[tracker set:kGAIScreenName
value:@"Home Screen"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
Or Automatic Screen Measurement:
Automatically measure views as screens using the
GAITrackedViewController
class. Have each of your view controllers
extend GAITrackedViewController
and add a property called screenName.
This property will be used to set the screen name field.
//
// MyViewController.h
// An example of using automatic screen tracking in a ViewController.
//
#import "GAITrackedViewController.h"
// Extend the provided GAITrackedViewController for automatic screen
// measurement.
@interface AboutViewController : GAITrackedViewController
@end
//
// MyViewController.m
//
#import "MyViewController.h"
#import "AppDelegate.h"
@implementation MyViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Set screen name.
self.screenName = @"Home Screen";
}
// Rest of the ViewController implementation.
@end
Event tracking:
link
To send an event to Google Analytics, use
GAIDictionaryBuilder.createEventWithCategory:action:label:value: and
send the hit, as in this example:
// 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" // Event category (required)
action:@"button_press" // Event action (required)
label:@"play" // Event label
value:nil] build]]; // Event value