Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added GoogleAnalytics tracking to iOS App

  • Loading branch information...
commit cae47d41559f0008308692cf4ee0cec908ba1229 1 parent 78caf5c
@rodja authored
View
13 ios-client/crosscopy-ios-client/AppDelegate.cs
@@ -16,6 +16,7 @@
using CrossCopy.iOSClient.UI;
using CrossCopy.iOSClient.Helpers;
using MonoTouch.MediaPlayer;
+using Analytics = GoogleAnalytics.GANTracker;
using CrossCopy.Api;
using MonoTouch.AssetsLibrary;
@@ -65,6 +66,11 @@ public partial class AppDelegate : UIApplicationDelegate
#region Methods
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
+ // only activated in release version
+ //Analytics.SharedTracker.StartTracker("UA-31324545-3",120, null);
+ NSError error;
+ Analytics.SharedTracker.TrackPageView("/launched", out error);
+
StoreHelper.Load ();
window = new UIWindow (UIScreen.MainScreen.Bounds);
@@ -83,6 +89,8 @@ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
rootDVC.ViewAppearing += (sender, e) => {
server.Abort ();
currentSecret = null;
+ NSError err;
+ Analytics.SharedTracker.TrackPageView("/secrets", out err);
};
navigation = new UINavigationController ();
@@ -102,12 +110,14 @@ public override void OnActivated (UIApplication application)
public override void DidEnterBackground (UIApplication application)
{
+ Analytics.SharedTracker.Dispatch();
StoreHelper.Save ();
}
public override void WillTerminate (UIApplication application)
{
StoreHelper.Save ();
+ Analytics.SharedTracker.StopTracker();
}
private RootElement CreateRootElement ()
@@ -424,6 +434,9 @@ private ImageButtonStringElement CreateImageButtonStringElement (Secret secret)
private void DisplaySecretDetail (Secret s)
{
+ NSError error;
+ Analytics.SharedTracker.TrackPageView("/session", out error);
+
var subRoot = new RootElement (s.Phrase)
{
(shareSection = new Section ("Share (no other devices connected)") {
View
BIN  ios-client/crosscopy-ios-client/GoogleAnalytics.dll
Binary file not shown
View
3  ios-client/crosscopy-ios-client/crosscopy-ios-client.csproj
@@ -78,6 +78,9 @@
<Reference Include="monotouch" />
<Reference Include="MonoTouch.Dialog-1" />
<Reference Include="System.Json" />
+ <Reference Include="GoogleAnalytics">
+ <HintPath>GoogleAnalytics.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
Please sign in to comment.
Something went wrong with that request. Please try again.