📜 ⬆️ ⬇️

iPhone + Google Analytics

Of course, everyone knows that Google Analytics is a great tool for assessing site traffic and building users' funnels. But few have heard that Google provides the same opportunity for mobile applications. In this post we will talk about how to integrate Google Analytics into your iOS application.
Note: post for beginners who have not done this before, and want to read detailed instructions.

First, you need to register with Google Analytics, specifying any site name. The most important thing is to get an identification number like UA-xxxxx-yy. Write it down, we will need it further.
Then go to Google Analytics for Mobile in the iOS section and download the iOS SDK .
Drag and drop the project GANTracker.h and libGoogleAnalytics.a into Xcode and add two libraries (specified in the project settings: CFNetwork and libsqlite3.0.dylib .
Everything! Now we climb into the code:
Import Library Header
#import "GANTracker.h"
Paste into the applicationDidFinishLaunching method : of your delegate AppDelegate , replacing UA-xxxxx-yy with your code:
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-xxxxx-yy"
dispatchPeriod:10
delegate:nil];

At this training is over. Now it remains to insert the Google Analytics call code in two cases:
First : select all pages in your application. In general, the page is a ViewController, which is fully displayed on the window. Then you need to insert the following lines into the viewDidLoad code: (do not forget #import "GANTracker.h"):
NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/app_entry_point"
withError:&error]) {
// Handle error here
}

Instead of "/ app_entry_point" you need to add the name of your page, for example "/ mainWindow". Well, inside the method you can handle an error event (if Google Analytics did not manage to register the page display).
Second : on the calls of all significant events that occur in your application, put a method call
NSError *error;
if (![[GANTracker sharedTracker] trackEvent:@"my_category"
action:@"my_action"
label:@"my_label"
value:-1
withError:&error]) {
// Handle error here
}

You need only the first two arguments: the name of the event and the caption for it (detailed information).
Now everything is exactly! Feel free to launch the application, and then open Google Analytics - all information about the functioning of the application will be immediately sent there. You can see the number of pages viewed and event calls, the distribution of visitors on the map, the number of unique users - in general, all that you can see for the site.
And now the most interesting thing is that you can build a user funnel: from the very first page (for example, we have a registration page) to the last important event (we have this sending the first message). And then look at the conversion rates - and find out at which step you are losing your audience.
We personally highly recommend adding tracking of all user actions in the application for Google Analytics. This will give you the opportunity to understand how to use your application, where there are problems and how to fix them - which means you can constantly improve the application and user experience.

')

Source: https://habr.com/ru/post/118828/


All Articles