Skip to content

Commit

Permalink
Update Analytics Sample
Browse files Browse the repository at this point in the history
Change-Id: Ic8c810b7c1ada497a355a3a869a9ef6a0d76dab7
  • Loading branch information
ulukaya committed May 5, 2017
1 parent 0197c94 commit e48c631
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
16 changes: 8 additions & 8 deletions ios/analytics/AnalyticsExample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// [START tracker_objc]
// Configure tracker from GoogleService-Info.plist.
NSError *configureError;
[[GGLContext sharedInstance] configureWithError:&configureError];
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);

// Optional: configure GAI options.
GAI *gai = [GAI sharedInstance];
gai.trackUncaughtExceptions = YES; // report uncaught exceptions
gai.logger.logLevel = kGAILogLevelVerbose; // remove before app release
[gai trackerWithTrackingId:@"YOUR_TRACKING_ID"];

// Optional: automatically report uncaught exceptions.
gai.trackUncaughtExceptions = YES;

// Optional: set Logger to VERBOSE for debug information.
// Remove before app release.
gai.logger.logLevel = kGAILogLevelVerbose;
// [END tracker_objc]

// Set a white background so that patterns are showcased.
Expand Down
15 changes: 7 additions & 8 deletions ios/analytics/AnalyticsExampleSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

// [START tracker_swift]
// Configure tracker from GoogleService-Info.plist.
var configureError: NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")

// Optional: configure GAI options.
guard let gai = GAI.sharedInstance() else {
assert(false, "Google Analytics not configured correctly")
}
gai.trackUncaughtExceptions = true // report uncaught exceptions
gai.logger.logLevel = GAILogLevel.verbose // remove before app release
gai.tracker(withTrackingId: "YOUR_TRACKING_ID")
// Optional: automatically report uncaught exceptions.
gai.trackUncaughtExceptions = true

// Optional: set Logger to VERBOSE for debug information.
// Remove before app release.
gai.logger.logLevel = .verbose;
// [END tracker_swift]

// Set a white background so that patterns are showcased.
Expand Down

0 comments on commit e48c631

Please sign in to comment.