{"id":92,"date":"2011-12-15T01:10:47","date_gmt":"2011-12-15T06:10:47","guid":{"rendered":"http:\/\/www.blackfrogguitars.com\/?p=92"},"modified":"2011-12-15T01:10:47","modified_gmt":"2011-12-15T06:10:47","slug":"google-analytics-for-web-and-mobile-traffic","status":"publish","type":"post","link":"http:\/\/blackfrogguitars.com\/?p=92","title":{"rendered":"Google Analytics – for web and mobile traffic"},"content":{"rendered":"

For some odd reason, I have always enjoyed tracking certain types of data. I was very happy when I hooked up the Jetpack suite of plugins for WordPress this past weekend and was then able to see basic site traffic information. Tonight (guess I should say this morning) I have also incorporated a second level of tracking – Google Analytics.<\/p>\n

Setting up Google Analytics to track your own app or web page is pretty simple. It will tie your analytics access to your Google account – a simple gmail account will be just fine.<\/p>\n

Go to http:\/\/www.google.com\/analytics\/ and click the link saying “New to Analytics -sign up now.” If you already have a google account just type in your credentials on the next page. \u00a0You will need to put a note in your app that clearly states that users are being tracked.<\/p>\n

Like many google pages, there is a gear on the top right.
\nClick the gear to go to the account administration screen
\nClick the plus sign to add a new account
\nNow you will enter the name and URL of the site or app you want to track.
\nAfter you have filled out this short form, Google will generate a unique identifier for you to use from your mobile app or web page. This ID in their terms is called a UA code.<\/p>\n

Once this is set up you are ready to use their UA code from your app or from your web page.<\/p>\n

Since this post is meant to be only a high level introduction, I will keep this short. Excellent documentation is available on the Google Analytics site.<\/p>\n

Tracking basic web pages<\/strong>
\nIf you want to track a web page, just cut and paste the javascript they give you when they generate the code.<\/p>\n

Tracking WordPress pages<\/strong>
\nIf you want to track your WordPress page, I recommend installing a plugin such as the Google Analytics for WordPress plugin. It will allow you to type this UA Code in and then do page level tracking.<\/p>\n

Tracking iOS page views<\/strong>
\nGrab the latest Analytics SDK directly from Google –\u00a0http:\/\/code.google.com\/apis\/analytics\/docs\/mobile\/download.html#Google_Analytics_SDK_for_iOS<\/a>
\nExtract it and copy the GANTracker.h and libGoogleAnayltics.a into your existing iOS project with Xcode.<\/p>\n

Open up your application delegate and in didFinishLaunching add the following snippet<\/p>\n

[[GANTracker sharedTracker] startTrackerWithAccountID:yourTrackerId\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 dispatchPeriod:10\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 delegate:nil];<\/pre>\n
\u00a0Now you can do page tracking with a simple line like this: (note I would put this in viewWillAppear in a view controller)<\/div>\n
\n
NSError *error;\nif (![[GANTracker sharedTracker] trackPageview:yourPageName withError:&error]) {\n\u00a0 \u00a0 \u00a0 \u00a0 NSLog(@\"Analytics logging failed %@\", error);\n}<\/pre>\n<\/div>\n

Conclusion<\/strong><\/p>\n

There is a lot more you can do besides page tracking, but this is enough to hopefully perk your interest and set something up. As you can see, it is really minimal effort to get something up and running. \u00a0 They have an API for Android and other platforms as well. \u00a0As I said before, Google’s documentation is great and for free analytics, it is really excellent! \u00a0 \u00a0The benefit of data like this is to aid you in creating better experiences for your users to see what features they like and what gets ignored. \u00a0Your biggest challenge will be in determining what and how much to track to gain the best insight into their needs.<\/p>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

For some odd reason, I have always enjoyed tracking certain types of data. I was very happy when I hooked up the Jetpack suite of plugins for WordPress this past weekend and was then able to see basic site traffic information. Tonight (guess I should say this morning) I have also incorporated a second level … Continue reading Google Analytics – for web and mobile traffic<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[18,20,58,78,103,120,149,177,179],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-development","tag-app-development","tag-apple","tag-development-2","tag-google-analytics","tag-javascript","tag-ios","tag-site-tracking","tag-web-development","tag-wordpress"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92"}],"version-history":[{"count":0,"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blackfrogguitars.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}