forked from xamarin/ios-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cs
55 lines (43 loc) · 1.21 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
namespace GoogleAnalytics
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
public partial class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Console.WriteLine ("Foo");
// Replace with your account information.
var account = "UA-000000-1";
int time = 10;
var tracker = GoogleAnalytics.GANTracker.SharedTracker;
tracker.StartTracker (account, time, null);
var label = new UILabel (new RectangleF (10, 90, 300, 20));
NSError error;
if (tracker.TrackPageView ("/app_entry_point", out error))
label.Text = "Tracking successfully sent!";
else
label.Text = "Error starting tracker";
// Force the event to be sent
tracker.Dispatch ();
window.AddSubview (label);
window.MakeKeyAndVisible ();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}