Friday 28 December 2012

Implementation the Google Analytics for Xcode (2.0 Beta 3)

Download the Analytics SDK for iOS (2.0 Beta 3)



Create a Google Analytics account for MobileApp

       Sign in Google Analytics --> Sign up --> What would you like to track? --> Choose App


If Want More Reference :      

https://developers.google.com/analytics/devguides/collection/ios/v2/                                                          


Step 1: Xcode --> Create New Project  
Step 2: Add headers and libraries to your project

Download the Google Analytics for iOS SDK and add these files from the SDK package to your app:
  • GAI.h
  • GAITracker.h
  • GAITrackedViewController.h
  • GAITransaction.h
  • GAITransactionItem.h
  • libGoogleAnalytics.a
Add the FrameWorks (or) Add the following to your application target's linked libraries:
  • CoreData.framework
  • SystemConfiguration.framework

Step 3: If you want to Track this page add the codings into ViewDidLoad (or) ViewWillAppear


Page View Analytics:

     id<GAITracker> tracker = [[GAI sharedInstancetrackerWithTrackingId:@"UA-XXXX-XX"];
    
     [tracker trackView:@"Sample_Tracking_Page"];

Event Analytics:

    id<GAITracker> tracker = [[GAI sharedInstancetrackerWithTrackingId:@"UA-XXXX-XX"];
   
    [tracker trackEventWithCategory:@"ButtonType"
                         withAction:@"Sample_Action"
                          withLabel:@"Action_Label"
                          withValue:[NSNumber numberWithInt:1]];

No comments: