AnDevCon - Tracking User Behavior Creatively


Published on

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

AnDevCon - Tracking User Behavior Creatively

  1. 1. Tracking User BehaviorCreativelyKiana TennysonAnDevCon VMay 2013
  2. 2. Disclaimer:™  IS a Feasibility Discussion™  NOT an Ethics Discussion™  NOT a Security Discussion™  Don’t go to jail, get sued or end up defamed inHuffington Post.
  3. 3. What is Analytics?™  Collection, analysis, reporting of internet data™  Two categories – onsite and offsite™  Two data collection methods™  Log file analysis™  Page tagging
  4. 4. What is User Tracking?™  Logging characteristics about the the user and theuser’s actions™  More granular study than Web Analytics™  Sticky subject!™  Public apps… highest priority == user permission™  Internal apps/corporate phones… different rules apply
  5. 5. Why do this?™  Understand and optimize app usage™  App assessment and improvement™  Business drivers (cost effectiveness, profit increase)™  Market research™  Safety (parental controls, employee usage)
  6. 6. User Story™  Web Analytics and User Tracking are meant to tell thestory of our user(s)
  7. 7. Common Analytics SoftwareSAAS™  Google Analytics™  Webtrends (paid)BYOH™  Open Web Analytics™  Piwik™  SnowPlow™  But…
  8. 8. Why not Analytics Sites?™  No outsourcing™  Extra needs/historical data™  Company policy™  Sensitive data
  9. 9. Open Web Analytics™  Host your own database server J™  Host your own analytics site™  Open source; extend what you want™  However: No Android client library… (contribute!)™  Extras:™  DomStream Tracking – tracks stream of mouse-oriented clicks(adapt to smartphone user interactions)™  CrossDomain Tracking – tracks same visitor across different webdomains
  10. 10. Google AnalyticsPlatform Overviewsource:
  11. 11. Google Analytics Workflow™  Workflow (ga.js):1.  Browser requests page containing tracking code2.  _gaq array holding tracking commands created3.  GA source code is fetched and loaded4.  Commands on _gaq array executed, tracking obj built5.  Script element loaded to DOM6.  Tracking obj collects data (via gif request)7.  Gif request used for logging, data coll., post-processing
  12. 12. And on Android…™  Same as conventional website tracking model™  Web Property Id required™  Four interaction types are tracked™  EasyTracker library (v2) almost no dev effort L™  Requires INTERNET andACCESS_NETWORK_STATE permissions
  13. 13. GA for Android Workflow™  Workflow:1.  tracker.trackEvent(…) called2.  event is put in localized SQLLite database on device as a“Hit”3.  At prescribed interval, dispatch occurs of collected data4.  tracker grabs “Hits” from local db5.  Sends them to NetworkDispatcher, which in turn posts anAsyncDispatchTask on a thread Handler6.  Handler sends hits over an HTTP connection viapipeLinedRequestor7.  When complete, callbacks are invoked, which sets a flag trueindicating the dispatcher is reopened for business
  14. 14. GoogleAnalyticsTrackerEvent (Hit)SQLLiteDatabaseNetworkDispatcherDispatchHandlerAsyncDispatchTaskPipelinedRequestorHttpConnectionCallbacks(start)(end)Workflow Visualized
  15. 15. google_analytics_v2.dbConnection™  Staging area for tracking data located on device™  Next stop: Google Analytics servers™  Command line access:™  From platform-tools directory, open Android DebugBridge (adb)™  adb -s emulator-5554 shell #example command™  sqlite3 google_analytics[_v2].db™  Begin issuing sqlite commands
  16. 16. ™  sqlite> .tables #list all tables in the db™  Most important table – events table™  Columns: hit_id, hit_time, hit_url, hit_string™  Data™  6!™  |1350361553317!™  |!™  |v=1&ul=en-us&t=appview&sr=480x800&an=Kiana+ByProxy&a=0&tid=UA-35996923-1&aid=com.kt.kbp&cid=25c2e0bb07c4d6d&_u=.B&av=1.0&_v=ma1b3&!google_analytics_v2.dbThe Table
  17. 17. Data Collection
  18. 18. Basic Interaction Types(Classic and Android)™  Page View Tracking™  Event Tracking™  Ecommerce/Transaction Tracking™  Custom Dimensions/Metrics™  Timing, Social, Exception…
  19. 19. Pageview Tracking™  Pageviews traditionally measure traffic volume to a site™  Mobile apps don’t really contain web *pages*™  App structure determines when a “page” is viewed™  Multiple activity structure™  Central activity, multiple fragments™  Central activity, multiple layouts L™  Any combo of the above™  Simple line tracks a lot under the hood
  20. 20. public class TestPage extends Activity {!!GoogleAnalyticsTracker tracker;!!@Override!protected void onCreate(Bundle savedInstanceState) {!super.onCreate(savedInstanceState);!!tracker = GoogleAnalyticsTracker.getInstance(); //singleton!tracker.startNewSession(“UA-XXXXX-YY”, this);!!setContentView(R.layout.test_layout);!!TextView helpLink = (TextView)findViewById(;!helpLink.setOnClickListener(new OnClickListener() {!!@Override!public void onClick(View view) {!tracker.sendView(“/helpPage”);!Intent intent = new Intent(TestPage.this, HelpPage.class);!startActivity(intent);!}!}!}!}!Pageview Tracking
  21. 21. Event Tracking™  Event tracking logs user interaction with the app™  Button/link clicks, viewing a video, anything™  Anything passed into GoogleAnalyticsTracker appearson the reporting interface (be consistent)™  Category™  Action™  Label (opt)™  Value (opt)™  Category/Action pairs should be unique
  22. 22. public class VideoPage extends Activity {!!GoogleAnalyticsTracker tracker;!!@Override!protected void onCreate(Bundle savedInstanceState) {!super.onCreate(savedInstanceState);!!tracker = GoogleAnalyticsTracker.getInstance(); //singleton!tracker.startNewSession(“UA-XXXXX-YY”, this);!!setContentView(R.layout.test_layout);!!TextView videoLink = (TextView)findViewById(;!videoLink.setOnClickListener(new OnClickListener() {!!@Override!public void onClick(View view) {!tracker.sendEvent(“Videos”, “Play”, videoId, 0);!//initiate video playback!}!}!}!}!Event Tracking
  23. 23. Ecommerce Tracking™  Track shopping carts and in-app purchases™  Additional classes required to track transactions:™  Transaction™  Item™  Process goes:1.  Create Transaction Object2.  Add Items to Transaction3.  Submit Transaction to Analytics Servers
  24. 24. public class PurchasePage extends Activity {!. . . !!public void onPurchaseConfirmed(Purchase purchase) {!!Transaction transaction = !new TransactionBuilder(purchase.getId(), !purchase.getTotal());!!transaction.setStoreName(Constants.STORE_NAME);!transaction.setShippingCost(purchase.getShippingCost());!transaction.setTotalTax(purchase.getTotalTax());!!for(LineItem lineItem : purchase.getLineItems() {!!tracker.addItem(new ItemBuilder(!!purchase.getId(),!lineItem.getProductId,!lineItem.getCost(),!lineItem.getQuantity())!.build()); !}!tracker.sendTransaction(transaction);!}!}!Ecommerce TrackingStep 1Step 2Step 3
  25. 25. Custom Dim/Metrics™  Upgrade from Custom Variables™  Three scopes (visitor, session, page)™  Page-scoped vars overlaps Event Tracking functionality™  20 slots (can get weird… so keep a chart)™  setCustomVar method™  Defaults to Page scope™  Does NOT send data like others, simply sets a variable
  26. 26. What Else to Track?™  Track user’s touch order on the layout™  OWA domstream tracking™  Track user’s touch location on the screen™  Set up clickable regions in layouts, perform eventtracking onClick()™  Track a user’s navigation session through your app
  27. 27. Reporting
  28. 28. External Data Integration™  Compare brick and mortar shops with mobile trafficvicinity™  Compare app activity to desktop site activity™  Correlate high/low volume usage with external userstatistics™  Customize dashboards that include GA data
  29. 29. GA ReportingFramework AccountPropertyProfileReportProfileReportPropertyProfileReport ReportProperty – website, blog, appProfile – A version of the property(Android, iOS, Blackberry)Query the profile tables via theCore Reporting API using theprofile id
  30. 30. App Report Categories™  Acquisitions™  How your app is found/downloaded/installed™  Users (who, where, when)™  Info about people using your app and their devices™  Engagement (what)™  Ways people use your app™  Outcomes (why)™  Track targeted objectives with goals, ecommerce
  31. 31. Core Reporting API™  Ability to export analytics data™  Java, Obj-C, Ruby, among other client libraries™  Data returned in JSON format™  Paginated and compressed responses available™  Daily limits to how much data returned
  32. 32. The Query™  Four required parameters:™  ids (unique table id is “ga:[profile id]”)™  start-date™  end-date™  metrics™  Fifth strongly suggested parameter:™  access_token – to get your full quota (OAuth 2.0)™  Without access_token, miniscule quota for testing
  33. 33. customVarValue5 == salesRepId)Select visits, customVarValue5 from 12345 wheredaysSinceLastVisit <= 5 and startDate => ‘2013-05-01’ andendDate <= ‘2013-05-30’ group by customVarValue5 limit 0, 50Sample Query
  34. 34. Compared to SQLAdditionally:Can sort by Metrics *and* Dimensions JCannot query across profile-ids LGAQueryMetrics Dim.ProfileID FiltersSQLQuerySelectCol.GroupByFrom(Table)Where
  35. 35. Dimensions/Metrics™  Max 7 dimensions (per query)™  Max 10 metrics (per query)™  At least one metric is required™  Not all combos are valid/make sense™  What’s the difference?™  Metric – a measurement of user activity™  Dimension – groups metrics across commonalities
  36. 36. Metrics™  Common ones™  visitors™  timeOnSite™  organicSearches™  adClicks™  goal(N)Completions™  Interesting ones™  serverConnectionTime™  domainLookupTime™  redirectionTime™  exceptions™  uniqueSocialInteractions
  37. 37. Dimensions™  Common ones™  visitorType™  campaign™  city/metro/region™  searchUsed™  language™  Interesting ones™  customVarName(N)™  mobileDeviceModel™  hostname™  nthMonth/Week/Day
  38. 38. Output™  JSON response format™  Client Libraries available™  Java, Python, Objective-C, Javascript™  Just use your favorite Json Parser Library
  39. 39. User Story
  40. 40. Who?™  Know your user™  By Individual – Corporate app that needs to trackrepresentative use in the field™  By Demographic – Publically downloaded gamecatering to young males aged 9-13™  Know what you can store about them™  Google Analytics policy expressly forbids:™  (S)PII storage™  Storing correlational data in 3rd party systems
  41. 41. PII and SPII(Sensitive) Personally Identifiable Information™  Full Name™  SSN™  Driver’s License #™  License Plate #™  Birthplace™  Credit card numbers™  Digital Identity (gray area)™  Date of Birth™  IP Address (sometimes)
  42. 42. GA – Answering “Who”™  All tracking calls intrinsically collect visitorinformation™  Decide what to query for™  ga:visitors™  ga:visitorType (new or returning)™  ga:source (indirectly related to user)™  ga:userActivityUserHandle
  43. 43. User Tracking – “Who”™  Secure.ANDROID_ID (Has limitations)™  TelephonyManager™  getSimSerialNumber()™  getDeviceId()™  Build.Serial (Good for tablets)™  Company-assigned ID™  The following could be logged to represent a user:
  44. 44. User Story
  45. 45. What?™  Know what your user is doing™  By Individual – path tracking™  By Demographic – event tracking, multi-channel funnels™  Know what [else] they typically do™  Most fundamental component of the User Story
  46. 46. GA – Answering “What”™  Data Collection – Event Tracking™  Reporting – Engagement Report type™  Querying for:™  ga:pageViews, ga:timeOnPage™  MultiChannel Funnels™  Reports created from sequences of interactions leadingto conversion or transaction
  47. 47. User Tracking – “What”™  Logging app usage via Singletons or local db inserts™  Strategy determined by UI™  Multiple Activity Structure – activity lifecycledrawbacks™  Single Activity/Multi Fragment – lifecycle benefits
  48. 48. User Story
  49. 49. When?™  When is your user in your app?™  Time of day, week, month, season™  Focus marketing efforts™  Just before app is needed™  To drive higher usage rates during low swings™  Push new features/content during or before high usagetimes
  50. 50. GA – Answering “When”™  No metrics correlating time and user activity™  Dimensions to query for actions around specified timesdo exist (ga:timeOnSite, ga:visitLength,ga:timeOnPage())™  Answer “when are users most likely to …?”™  Use a page level custom variable™  tracker.setCustomVar(s, “Time ItemPurchase”,! ! !dateTime.toString(), 3) !
  51. 51. User Tracking – “When’’™  Log system time when user makes important action™  Time zone issues – log in UTC™  Log start/end of session™  Depending on UI structure, determine “session times”™  Submit data group when session is complete, or at endof dispatch period
  52. 52. User Story
  53. 53. Where?™  Where does your user most utilize your app?™  What states/cities/etc is your app most popular?™  Concentrate marketing efforts in less popular areas™  Proximity awards™  Field reps in region/expanding regions™  Apps with parental control features
  54. 54. GA – Answering “Where”™  No metrics to correlate geolocation to activity™  Dimensions exist; collected from IP Address duringHTTP Requests™  ga:continent down to ga:latitude/longitude, etc
  55. 55. User Tracking – “Where’’™  Log location with android.location package™  Locations don’t come on demand™  Request updates from Context.Location_Service™  Define a LocationListener ready to receive/handle updates™  Choose best algorithm for selecting location™  Trade-off between killing user’s battery and accuracy™  Once location received, hold on until ready to send withother tracking data
  56. 56. User Story
  57. 57. Why?™  When users convert and complete goals, it is easy toanswer “Why”™  When users are NOT participating in goal conversion/completion,™  Focus research on pageViews™  Focus on events occurring on the higher ratedpageViews
  58. 58. GA – Answering “Why”™  Subjective question; no concrete method to answer“Why” a user uses your app™  Align app goals with with user’s actions™  Accept your app’s purpose to the user to fully realize itspotential
  59. 59. User Tracking – “Why’’™  Too subjective for User Tracking
  60. 60. Wrap Up™  Mobile devices are quickly becoming one of the mostcommonly used personal computers™  Understand the boundaries of user privacy™  Protect our users; they keep us “in business” J
  61. 61. Questions?