Skip to content

Facilitates the use of Google Analytics API for iOS.

License

Notifications You must be signed in to change notification settings

sumitmundra/NZGoogleAnalytics

Repository files navigation

#NZGoogleAnalytics License MIT

Quickly and easily integration with Google Analytics API for iOS.

Build Status Cocoapods Cocoapods

Requirements

NZGoogleAnalytics works on iOS 5.0+ version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework

You will need LLVM 3.0 or later in order to build NZGoogleAnalytics.

NZGoogleAnalytics uses Google Analytics SDK for iOS and NZBundle.

Adding NZGoogleAnalytics to your project

Cocoapods

CocoaPods is the recommended way to add NZGoogleAnalytics to your project.

  • Add a pod entry for NZGoogleAnalytics to your Podfile:
pod 'NZGoogleAnalytics', '~> 0.0.1'
  • Install the pod(s) by running:
pod install

Source files

Alternatively you can directly add source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop all files at NZGoogleAnalytics folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Install Google Analytics SDK for iOS and your frameworks dependencies
  4. Install NZBundle

Info

  • Default values for debug/release mode:

    • trackUncaughtExceptions: NO
    • dispatchInterval: 5 seconds
    • logLevel: kGAILogLevelNone
  • Default values for distribution mode:

    • trackUncaughtExceptions: YES
    • dispatchInterval: 20 seconds
    • logLevel: kGAILogLevelNone
  • NZGoogleAnalytics use NZBundle for change build version name:

    • Debug and Relase: X.X.Xa alpha
    • Distribution: X.X.Xa

Usage

  • You will need to define NZ_GA_TRACKINGID at your project prefix header *-Prefix.pch:
// define your Google Analytics Tracking ID
#define NZ_GA_TRACKINGID "UA-000000-01"
  • The NZGoogleAnalytics overrides the +(void)load; method of NSObject class, which is called every time the application starts.

  • You can change the default setting:

#import "NZGoogleAnalytics.h"
...
[NZGoogleAnalytics setTrackUncaughtExceptions:YES];
BOOL trackUncaughtExceptions = [NZGoogleAnalytics trackUncaughtExceptions];
    
[NZGoogleAnalytics setDispatchInterval:60];
NSTimeInterval dispatchInterval = [NZGoogleAnalytics dispatchInterval];
    
[NZGoogleAnalytics setLogLevel:kGAILogLevelError];
GAILogLevel logLevel = [NZGoogleAnalytics logLevel];
  • Easy track your View Controller:

    • Add NZGoogleAnalytics-Tracker.plist file to your project with the following configuration:
      • class_name: Your view controller class name
      • view_name: Your track view name

NZCircularImageView

  • Configure your View Controller class:
#import "NZGoogleAnalyticsTracker.h"
...

// screen name: /ios/first_view
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [NZGoogleAnalyticsTracker trackViewWithController:self];
}
#import "NZGoogleAnalyticsTracker.h"
...

// screen name: /ios/first_view/id_001
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [NZGoogleAnalyticsTracker trackViewWithController:self withIdentifier:@"id_001"];
}

License

This code is distributed under the terms and conditions of the MIT license.

Change-log

A brief summary of each NZGoogleAnalytics release can be found on the wiki.

About

Facilitates the use of Google Analytics API for iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published