Knowing is Understanding: A road trip through Google analytics for Windows Phone
-
Upload
blugri-software-services-bvba -
Category
Technology
-
view
108 -
download
4
description
Transcript of Knowing is Understanding: A road trip through Google analytics for Windows Phone
Knowing is Understanding
A road trip through Google analytics for Windows Phone
Who is
Tom Janssens
Who is?
• Name: Tom Janssens
• Independent consultant• Starting indie game developer
• www: http://www.blugri.com• Facebook:
http://www.facebook.com/blugri• Twitter: @blugri
Google Analytics
Account Setup
Google Analytics – Account setup
• Accounts• Web Properties• Profiles• Filters
• Advanced Segments• Dashboards
Google Analytics – Account structure
Username / Login
Account
Web property
Profile 1
Filter
Profile 2
Filter
Filter
Web property
Profile 1
Filter
Account
Web property
Profile 1
Filter
Profile 2
Filter
Filter
Google Analytics – Accounts
• You can only start 20 accounts• Given access to unlimited accounts
!!! No more than one client / account !!!
Google Analytics – Web Properties
• An account can have only 50 properties
• Web Property = tracking code
!!! Web property is in a single account !!!
Google Analytics – Profiles and Filters
• Limited to 50 profiles (over all properties)
• Filters incoming data• Filters executed in order of definition• Always keep a profile with all raw data
!!! Filters do not work on Custom Variables !!!
Google Analytics – Advanced Segments
• Isolate and analyse your analytics data
• Default or Custom Advanced Segments
Google Analytics – Dashboards
• Sticky to login• Configuration sharing• Widgets added via filters• Export and Email
Google Analytics – Dashboards
Google Analytics – Multiple apps
• Use advances segments• Or filter on e.g.
– Page title
Google Analytics – Going live
• Go to marketplace• Search “sudoku”• Search this icon
• Download and start!
• Or scan QR-code
For Windows Phone
Microsoft Silverlight Analytics Framework
MSAF
• Web analytics Framework• Supports
– Silverlight, WPF and Windows Phone– Offline scenarios– Pageview and event tracking– …
• Extensible• Get it from http://msaf.codeplex.com/
MSAF
The code
C#
Adding it to your application
<Application.ApplicationLifetimeObjects> <!--Required object that handles lifetime events for the application--> <shell:PhoneApplicationService Launching="Application_Launching" Closing="Application_Closing" Activated="Application_Activated" Deactivated="Application_Deactivated"/>
<Analytics:AnalyticsService x:Name="analyticsService" WebPropertyId="UA-12345678-9" AutomaticPageTrackingEnabled="True" /> </Application.ApplicationLifetimeObjects>
• Add the code to your App.xaml
Adding it to your application
<pre class="brush: csharp;">public partial class App : Application { private AnalyticsTracker _tracker; public AnalyticsTracker Tracker { get { if (_tracker == null) { AnalyticsService service = null; foreach (var obj in this.ApplicationLifetimeObjects) { if (typeof(AnalyticsService).Equals(obj.GetType())) { service = obj as AnalyticsService; break; } } _tracker = new AnalyticsTracker(service); } return _tracker; } } }
• And to App.xaml.cs
Application properties
• Google Analytics: 5 custom variables
Key 1: ProductID
Key 2: User defined
Key 3: User defined
Key 4: User defined
Key 5: User defined
public class AnalyticsService : IApplicationService{ private readonly IApplicationService _innerService; private readonly GoogleAnalytics _googleAnalytics;
public AnalyticsService() { _googleAnalytics = new GoogleAnalytics(); _googleAnalytics.CustomVariables.Add( new PropertyValue
{ PropertyName = "Device ID",
Value = AnalyticsProperties.DeviceId }); ... }}
Reading the manifest public class PhoneHelper { const string AppManifestName = "WMAppManifest.xml"; const string AppNodeName = "App";
public static string GetAppAttribute(string attributeName) { try { var settings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() };
using (var rdr = XmlReader.Create(AppManifestName, settings)) { rdr.ReadToDescendant(AppNodeName); if (!rdr.IsStartElement()) { throw new FormatException(AppManifestName + " is missing " + AppNodeName); } return rdr.GetAttribute(attributeName); } } catch (Exception) { return ""; } } }
Copy fromhttp://coding4fun.codeplex.com/
Pageview Trackingpublic class AnalyticsService : IApplicationService{ private readonly IApplicationService _innerService; private readonly GoogleAnalytics _googleAnalytics;
public AnalyticsService() { _googleAnalytics = new GoogleAnalytics(); _googleAnalytics.CustomVariables.Add( new PropertyValue
{ PropertyName = "Device ID",
Value = AnalyticsProperties.DeviceId }); ... _innerService = new WebAnalyticsService { IsPageTrackingEnabled = true, Services = { _googleAnalytics, } }; }}
Pageview Tracking
• Basic tracking– For apps with many pages– Shows in analytics as pagename.xaml?
p1=v1• Realtime analytics
Event Trackingpublic class AnalyticsTracker{ private AnalyticsService _service;
public AnalyticsTracker(AnalyticsService service) { CompositionInitializer.SatisfyImports(this);
_service = service; }
[Import("Log")] public Action<AnalyticsEvent> Log { get; set; }
public void Track(string category, string name, string actionValue) { Log(new AnalyticsEvent { Category = category, Name = name, ObjectName = actionValue }); }}
Event Trackingused for pageviewspublic void TrackPageView(string pageViewName){ // Avoid double tracking if (_service != null && !_service.AutomaticPageTrackingEnabled) { Log(new AnalyticsEvent { ActionValue = pageViewName, HitType = Microsoft.WebAnalytics.Data.HitType.PageView, Name = "CurrentScreenChanged", NavigationState = pageViewName, ObjectType = pageViewName, AppName = Analytics.AnalyticsProperties.ApplicationTitle }); } }}
Use page name for application filtering
Give your pagetracking a user-friendly name
References
• Google.WebAnalytics• Microsoft.WebAnalytics• Microsoft.WebAnalytics.Behaviors• Microsoft.WebAnalytics.Navigation• Microsoft.SilverlightMediaFramework.Comp
atibility.Phone– Replaces:
• System.ComponentModel.Composition• System.ComponentModel.Composition.Initialization
• System.Windows.Interactivity
Tracking options
Useful tracks
Useful trackings
• Reviews and Sharing– Event Tracking– Get insights where to place your share /
review buttons
Useful trackings
• Version Tracking– Updates vs new downloads– Sticky users vs user growth– Store current version in isolated storage
Useful trackingsstring installedVersion = AppSettingsAndStatistics.Instance.ApplicationVersion;string currentVersion = Analytics.AnalyticsProperties.ApplicationVersion;
if (installedVersion == null){ AppSettingsAndStatistics.Instance.ApplicationVersion = currentVersion;
((Sudoku.App)App.Current).Tracker.Track("Installation”, "New", string.Format("new version: {0}”, Analytics.AnalyticsProperties.ApplicationVersion));}else if (!installedVersion.Equals(currentVersion)) { AppSettingsAndStatistics.Instance.ApplicationVersion = currentVersion;
((Sudoku.App)App.Current).Tracker.Track("Installation", "Update", string.Format("old version: {0} - new version: {1}", installedVersion, currentVersion));}
Useful trackings
• Application events– Game modes
• Game controls• Levels played / Difficulty
– Use of Hints, Tips, …– Advertising
• Providers• Number of ads displayed, clicked
– …
Resources
Links
Links
• https://www.google.com/ads/agencyedge/
• http://msaf.codeplex.com/
• http://www.windowsphonegeek.com/news/analyze-the-use-of-a-wp7-app-with-google-analytics-and-microsoft-silverlight-analytics-framework-msaf