From f136794617ec1fe45cdc88a6962a6841616e55af Mon Sep 17 00:00:00 2001 From: Knut Inge Grosland <”hei@knutinge.com”> Date: Tue, 26 May 2015 23:48:38 +0100 Subject: [PATCH] Added Google Analytics --- App Reviews.xcodeproj/project.pbxproj | 2 +- AppReviews/AppDelegate.swift | 11 +++++++---- AppReviews/Base.lproj/Main.storyboard | 4 ++-- Podfile | 3 ++- Podfile.lock | 3 +++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/App Reviews.xcodeproj/project.pbxproj b/App Reviews.xcodeproj/project.pbxproj index 4ffaaeb..8345c4b 100644 --- a/App Reviews.xcodeproj/project.pbxproj +++ b/App Reviews.xcodeproj/project.pbxproj @@ -245,6 +245,7 @@ 49ACB83D1AD5CAA00050C1B7 /* App Reviews */ = { isa = PBXGroup; children = ( + 4910B4351B0E8E7300FDC0EA /* AppDelegate.swift */, 4910B3E51B0E200200FDC0EA /* ReviewManager */, 49F800F51ADC840C004A1BF1 /* Window & ViewControllers */, 49F800F41ADC83EC004A1BF1 /* Views */, @@ -316,7 +317,6 @@ isa = PBXGroup; children = ( 4910B49A1B0E906800FDC0EA /* Main.storyboard */, - 4910B4351B0E8E7300FDC0EA /* AppDelegate.swift */, 4910B4371B0E8E8400FDC0EA /* StatusMenuController.swift */, 4910B4391B0E8E9600FDC0EA /* ApplicationViewController.swift */, 4910B43A1B0E8E9600FDC0EA /* ApplicationWindowController.swift */, diff --git a/AppReviews/AppDelegate.swift b/AppReviews/AppDelegate.swift index 822e383..116c955 100644 --- a/AppReviews/AppDelegate.swift +++ b/AppReviews/AppDelegate.swift @@ -8,8 +8,7 @@ import Cocoa import AppKit - -// #define Color(value) (value) / 255.0 +import SimpleCocoaAnalytics @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { @@ -24,8 +23,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(aNotification: NSNotification) { - // UA-62792522-4 - + var analyticsHelper = AnalyticsHelper.sharedInstance() + analyticsHelper.recordScreenWithName("Launch") + analyticsHelper.beginPeriodicReportingWithAccount("UA-62792522-3", name: "App Reviews OSX", version: NSApplication.v_versionBuild()) + // Create ReviewManager shared object var manager = ReviewManager.start() @@ -35,6 +36,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationWillTerminate(aNotification: NSNotification) { // Insert code here to tear down your application + AnalyticsHelper.sharedInstance().handleApplicationWillClose() + NSUserDefaults.standardUserDefaults().synchronize() } func applicationShouldTerminate(sender: NSApplication) -> NSApplicationTerminateReply { diff --git a/AppReviews/Base.lproj/Main.storyboard b/AppReviews/Base.lproj/Main.storyboard index ace79a5..4df237b 100644 --- a/AppReviews/Base.lproj/Main.storyboard +++ b/AppReviews/Base.lproj/Main.storyboard @@ -137,7 +137,7 @@ - + @@ -151,7 +151,7 @@ - + diff --git a/Podfile b/Podfile index 761e605..18caf44 100644 --- a/Podfile +++ b/Podfile @@ -9,4 +9,5 @@ use_frameworks! pod 'SwiftyJSON', '~> 2.2' pod 'Alamofire', '~> 1.2' pod 'EDStarRating', '~> 1.1' -pod 'Sparkle', '~> 1.9' \ No newline at end of file +pod 'Sparkle', '~> 1.9' +pod 'SimpleCocoaAnalytics', '~> 0.1' \ No newline at end of file diff --git a/Podfile.lock b/Podfile.lock index b08e696..76e9ebf 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,18 +1,21 @@ PODS: - Alamofire (1.2.1) - EDStarRating (1.1) + - SimpleCocoaAnalytics (0.1.0) - Sparkle (1.9.0) - SwiftyJSON (2.2.0) DEPENDENCIES: - Alamofire (~> 1.2) - EDStarRating (~> 1.1) + - SimpleCocoaAnalytics (~> 0.1) - Sparkle (~> 1.9) - SwiftyJSON (~> 2.2) SPEC CHECKSUMS: Alamofire: 1acfdf179aff68b41a48dff70c1ac7fa263e2bcb EDStarRating: a41a6440a945020745d0e9ff8ada7d1afa952114 + SimpleCocoaAnalytics: cc95e551884ec851002c668d15b71b8a73e92f56 Sparkle: 75bbbc5ab2d666f7f77c241afe7fd28364a8f9f7 SwiftyJSON: 0b3e6c07af17ff745e77e8e9984097b55c956e5c