Google Analytics for
iOS
Created by:
Pawan Ramteke
(iOS Developer)
(4-3-2016)
It is a service offered by Google that generates
detailed statistics about your website or mobile app’s
usage.
Google Analytics is a great tool for measuring your
app’s usage to test if new features are working both
functionally and experientially.
What is Google
Analytics ?
Google Analytics for your
App
Go to www.google.com/analytics. The homepage should
appear like so:
Click here for sign
in
Sign in to Google Analytics
To start Analytics for your account you need to sign in with your Google
account. After click on sign in button , Select Google Analytics Option and
then continue sign in.
Once you sign in with Google account , the first screen you will see, the
Steps to Analyze your app or website.
After Click on Sign up button , you will see the page to create new account
for your app.
Google then asks you to submit the details for the app you want to track.
Make sure to choose Mobile app at the top and enter the information as
required.
Google then generate a unique Tracking Id for submitted App.
Admin Name
Your App
Name
Downloading the Google Analytics iOS
SDK
After generating a Tracking Id , Google provide you a link for downloading
the SDK for appropriate app and also show the steps for integrating the
SDK to your app.
Click here to download SDK for iOS
After click on the SDK download link , Google provide a steps to add
analytics to your app and also provide the link to download the
configuration file for your project.
Click here to download the Configuration
File
After clicking GET CONFIGURATION FILE button , a new POPUP window will
open in which you have to add your registered App name and you’re your
app Tracking Id in iOS Bundle Id box.
1.Click here to
analyze app
2.Click here to
get configuration
file
Download plist
file and add to
your app file
Select the Admin view on the top right.
You will see the main dashboard area for managing your
Accounts, Properties, and Views.
Account Property View
(profile)
Dashboard for User
Setting up Analysis for
AppOpen your app where you want to add Analysis.
Add GoogleService-Info.plist file in your project
Create Cocoa pods for app
Analytics uses CocoaPods to install and manage
dependencies.
Open project file in finder.
If you have not already created a Podfile for your application,
create one now: Open terminal and type pod init
Open the Podfile created for your application and add the
following:
platform :iOS, ’7.0’
use_frameworks!
pod 'Google/Analytics'
Save the file and run: pod install
This creates an .xcworkspace file for your application. Use this
After installation of pod in your project it will create a pod files.
Open Podfile
Initialize Analytics for your
app
Now that you have the configuration file for your project, you're ready to
begin implementing. First, configure the shared Analytics object inside
AppDelegate.
To do these changes, first add Analytics inside AppDelegate:
#import <Google/Analytics.h>
Then, overload the didFinishLaunchingWithOptions method to configure
GGLContext:
// 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
Add screen tracking
To keep track of screen:
Open a View Controller that you'd like to track.
Your code should do the following:
Add the required <Google/Analytics.h> header.
Use a viewWillAppear method to insert screen tracking.
Provide a name for the screen and execute tracking.
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:@”name of Tracking View”];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
Enjoy Coding

Google analytics for iOS

  • 1.
    Google Analytics for iOS Createdby: Pawan Ramteke (iOS Developer) (4-3-2016)
  • 2.
    It is aservice offered by Google that generates detailed statistics about your website or mobile app’s usage. Google Analytics is a great tool for measuring your app’s usage to test if new features are working both functionally and experientially. What is Google Analytics ?
  • 3.
    Google Analytics foryour App Go to www.google.com/analytics. The homepage should appear like so: Click here for sign in
  • 4.
    Sign in toGoogle Analytics To start Analytics for your account you need to sign in with your Google account. After click on sign in button , Select Google Analytics Option and then continue sign in. Once you sign in with Google account , the first screen you will see, the Steps to Analyze your app or website.
  • 5.
    After Click onSign up button , you will see the page to create new account for your app. Google then asks you to submit the details for the app you want to track. Make sure to choose Mobile app at the top and enter the information as required. Google then generate a unique Tracking Id for submitted App. Admin Name Your App Name
  • 6.
    Downloading the GoogleAnalytics iOS SDK After generating a Tracking Id , Google provide you a link for downloading the SDK for appropriate app and also show the steps for integrating the SDK to your app. Click here to download SDK for iOS
  • 7.
    After click onthe SDK download link , Google provide a steps to add analytics to your app and also provide the link to download the configuration file for your project. Click here to download the Configuration File
  • 8.
    After clicking GETCONFIGURATION FILE button , a new POPUP window will open in which you have to add your registered App name and you’re your app Tracking Id in iOS Bundle Id box.
  • 9.
    1.Click here to analyzeapp 2.Click here to get configuration file Download plist file and add to your app file
  • 10.
    Select the Adminview on the top right. You will see the main dashboard area for managing your Accounts, Properties, and Views. Account Property View (profile) Dashboard for User
  • 11.
    Setting up Analysisfor AppOpen your app where you want to add Analysis. Add GoogleService-Info.plist file in your project
  • 12.
    Create Cocoa podsfor app Analytics uses CocoaPods to install and manage dependencies. Open project file in finder. If you have not already created a Podfile for your application, create one now: Open terminal and type pod init Open the Podfile created for your application and add the following: platform :iOS, ’7.0’ use_frameworks! pod 'Google/Analytics' Save the file and run: pod install This creates an .xcworkspace file for your application. Use this
  • 13.
    After installation ofpod in your project it will create a pod files. Open Podfile
  • 14.
    Initialize Analytics foryour app Now that you have the configuration file for your project, you're ready to begin implementing. First, configure the shared Analytics object inside AppDelegate. To do these changes, first add Analytics inside AppDelegate: #import <Google/Analytics.h> Then, overload the didFinishLaunchingWithOptions method to configure GGLContext: // 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
  • 16.
    Add screen tracking Tokeep track of screen: Open a View Controller that you'd like to track. Your code should do the following: Add the required <Google/Analytics.h> header. Use a viewWillAppear method to insert screen tracking. Provide a name for the screen and execute tracking. id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker]; [tracker set:kGAIScreenName value:@”name of Tracking View”]; [tracker send:[[GAIDictionaryBuilder createScreenView] build]];
  • 18.