Created
June 19, 2014 10:19
-
-
Save wtuts/e541a12d1a33a8a4b573 to your computer and use it in GitHub Desktop.
Google analytics for Windows phone app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constructor | |
public MainPage() | |
{ | |
InitializeComponent(); | |
//For page view add the following line in each page constructor | |
GoogleAnalytics.EasyTracker.GetTracker().SendView("MainPage"); | |
} | |
//For button click event handlers add the following code | |
private void Button_Click_1(object sender, RoutedEventArgs e) | |
{ | |
GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Main category", "Sub category 1", "Sub category 2", 0); | |
//If you don't have any Sub category.You can leave the value of Sub category 1 , Sub category 2 or both as null. | |
//for example | |
//GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Button clicks", null, null, 0); | |
//Error exception | |
try | |
{ | |
//do something | |
} | |
catch (NotImplementedException exc) | |
{ | |
//You can send the error message from the app by the following code. | |
GoogleAnalytics.EasyTracker.GetTracker().SendException(exc.Message, false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment