SlideShare a Scribd company logo
Tracking User Behavior
Creatively
Kiana Tennyson
AnDevCon V
May 2013
Disclaimer:
™  IS a Feasibility Discussion
™  NOT an Ethics Discussion
™  NOT a Security Discussion
™  Don’t go to jail, get sued or end up defamed in
Huffington Post.
What is Analytics?
™  Collection, analysis, reporting of internet data
™  Two categories – onsite and offsite
™  Two data collection methods
™  Log file analysis
™  Page tagging
What is User Tracking?
™  Logging characteristics about the the user and the
user’s actions
™  More granular study than Web Analytics
™  Sticky subject!
™  Public apps… highest priority == user permission
™  Internal apps/corporate phones… different rules apply
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)
User Story
™  Web Analytics and User Tracking are meant to tell the
story of our user(s)
Common Analytics Software
SAAS
™  Google Analytics
™  Webtrends (paid)
BYOH
™  Open Web Analytics
™  Piwik
™  SnowPlow
™  But…
Why not Analytics Sites?
™  No outsourcing
™  Extra needs/historical data
™  Company policy
™  Sensitive data
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 web
domains
Google Analytics
Platform Overview
source: www.Google-Analytics.com
Google Analytics Workflow
™  Workflow (ga.js):
1.  Browser requests page containing tracking code
2.  _gaq array holding tracking commands created
3.  GA source code is fetched and loaded
4.  Commands on _gaq array executed, tracking obj built
5.  Script element loaded to DOM
6.  Tracking obj collects data (via gif request)
7.  Gif request used for logging, data coll., post-processing
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 and
ACCESS_NETWORK_STATE permissions
GA for Android Workflow
™  Workflow:
1.  tracker.trackEvent(…) called
2.  event is put in localized SQLLite database on device as a
“Hit”
3.  At prescribed interval, dispatch occurs of collected data
4.  tracker grabs “Hits” from local db
5.  Sends them to NetworkDispatcher, which in turn posts an
AsyncDispatchTask on a thread Handler
6.  Handler sends hits over an HTTP connection via
pipeLinedRequestor
7.  When complete, callbacks are invoked, which sets a flag true
indicating the dispatcher is reopened for business
Google
Analytics
Tracker
Event (Hit)
SQLLite
Database
Network
Dispatcher
Dispatch
Handler
AsyncDispatch
Task
Pipelined
Requestor
Http
Connection
Callbacks
(start)
(end)
Workflow Visualized
google_analytics_v2.db
Connection
™  Staging area for tracking data located on device
™  Next stop: Google Analytics servers
™  Command line access:
™  From platform-tools directory, open Android Debug
Bridge (adb)
™  adb -s emulator-5554 shell #example command
™  sqlite3 google_analytics[_v2].db
™  Begin issuing sqlite commands
™  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!
™  |http://www.google-analytics.com/collect!
™  |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&cd=com.kt.kbp.flickr.FlickrActivity!
google_analytics_v2.db
The Table
Data Collection
Basic Interaction Types
(Classic and Android)
™  Page View Tracking
™  Event Tracking
™  Ecommerce/Transaction Tracking
™  Custom Dimensions/Metrics
™  Timing, Social, Exception…
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
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(R.id.helpLink);!
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
Event Tracking
™  Event tracking logs user interaction with the app
™  Button/link clicks, viewing a video, anything
™  Anything passed into GoogleAnalyticsTracker appears
on the reporting interface (be consistent)
™  Category
™  Action
™  Label (opt)
™  Value (opt)
™  Category/Action pairs should be unique
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(R.id.videoLink);!
videoLink.setOnClickListener(new OnClickListener() {!
!
@Override!
public void onClick(View view) {!
tracker.sendEvent(“Videos”, “Play”, videoId, 0);!
//initiate video playback!
}!
}!
}!
}!
Event Tracking
Ecommerce Tracking
™  Track shopping carts and in-app purchases
™  Additional classes required to track transactions:
™  Transaction
™  Item
™  Process goes:
1.  Create Transaction Object
2.  Add Items to Transaction
3.  Submit Transaction to Analytics Servers
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 Tracking
Step 1
Step 2
Step 3
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
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 event
tracking onClick()
™  Track a user’s navigation session through your app
Reporting
External Data Integration
™  Compare brick and mortar shops with mobile traffic
vicinity
™  Compare app activity to desktop site activity
™  Correlate high/low volume usage with external user
statistics
™  Customize dashboards that include GA data
GA Reporting
Framework Account
Property
Profile
Report
Profile
Report
Property
Profile
Report Report
Property – website, blog, app
Profile – A version of the property
(Android, iOS, Blackberry)
Query the profile tables via the
Core Reporting API using the
profile id
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
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
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
https://www.googleapis.com/analytics/v2.4/data
?ids=12345
&dimensions=ga:customVarValue5
&metrics=ga:visits
&filters=ga:daysSinceLastVisit%3E%3D5
&start-date=2013-05-01
&end-date=2013-05-30
&max-results=50
(Where customVarValue5 == salesRepId)
Select visits, customVarValue5 from 12345 where
daysSinceLastVisit <= 5 and startDate => ‘2013-05-01’ and
endDate <= ‘2013-05-30’ group by customVarValue5 limit 0, 50
Sample Query
Compared to SQL
Additionally:
Can sort by Metrics *and* Dimensions J
Cannot query across profile-ids L
GA
Query
Metrics Dim.
Profile
ID Filters
SQL
QuerySelect
Col.
Group
By
From
(Table)
Where
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
Metrics
™  Common ones
™  visitors
™  timeOnSite
™  organicSearches
™  adClicks
™  goal(N)Completions
™  Interesting ones
™  serverConnectionTime
™  domainLookupTime
™  redirectionTime
™  exceptions
™  uniqueSocialInteractions
Dimensions
™  Common ones
™  visitorType
™  campaign
™  city/metro/region
™  searchUsed
™  language
™  Interesting ones
™  customVarName(N)
™  mobileDeviceModel
™  hostname
™  nthMonth/Week/Day
Output
™  JSON response format
™  Client Libraries available
™  Java, Python, Objective-C, Javascript
™  Just use your favorite Json Parser Library
User Story
Who?
™  Know your user
™  By Individual – Corporate app that needs to track
representative use in the field
™  By Demographic – Publically downloaded game
catering 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
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)
GA – Answering “Who”
™  All tracking calls intrinsically collect visitor
information
™  Decide what to query for
™  ga:visitors
™  ga:visitorType (new or returning)
™  ga:source (indirectly related to user)
™  ga:userActivityUserHandle
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:
User Story
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
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 leading
to conversion or transaction
User Tracking – “What”
™  Logging app usage via Singletons or local db inserts
™  Strategy determined by UI
™  Multiple Activity Structure – activity lifecycle
drawbacks
™  Single Activity/Multi Fragment – lifecycle benefits
User Story
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 usage
times
GA – Answering “When”
™  No metrics correlating time and user activity
™  Dimensions to query for actions around specified times
do 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) !
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 end
of dispatch period
User Story
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
GA – Answering “Where”
™  No metrics to correlate geolocation to activity
™  Dimensions exist; collected from IP Address during
HTTP Requests
™  ga:continent down to ga:latitude/longitude, etc
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 with
other tracking data
User Story
Why?
™  When users convert and complete goals, it is easy to
answer “Why”
™  When users are NOT participating in goal conversion/
completion,
™  Focus research on pageViews
™  Focus on events occurring on the higher rated
pageViews
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 its
potential
User Tracking – “Why’’
™  Too subjective for User Tracking
Wrap Up
™  Mobile devices are quickly becoming one of the most
commonly used personal computers
™  Understand the boundaries of user privacy
™  Protect our users; they keep us “in business” J
Questions?

More Related Content

PDF
Search APIs & Universal Links
PDF
Introducing Cardio
PPTX
Google+ sign in for mobile & web apps
PPTX
Advanced Google Analytics
PPTX
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
PPTX
Fraudpointer - Google Apps integration
PPTX
Microsoft identity platform developer community call-October 2019
PDF
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
Search APIs & Universal Links
Introducing Cardio
Google+ sign in for mobile & web apps
Advanced Google Analytics
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Fraudpointer - Google Apps integration
Microsoft identity platform developer community call-October 2019
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi

Viewers also liked (18)

PPTX
Unit 1 LO2 - Audience Profiling PowerPoint
PPTX
Behavioral targeting
PDF
The Role of the Internet and New Media on Consumer and Firm Behavior
PDF
Making search better by tracking & utilizing user search behavior
PPTX
Basics of Behavioral Targeting
PPT
Web Usage Pattern
PPT
E Marketing Ch7 Consumer Behavior
PPTX
Chapter 6 e-marketing research
PPTX
Consumer Behavior
PPT
Ec2009 ch04 consumer behavior
PDF
Online Consumer Behavior
DOCX
How media producers define their target audience
PPT
Audience Profiling Powerpoint
PPTX
customer behavior in e-commerce
KEY
User Behavior Tracking with Google Analytics, Garb, and Vanity
PDF
Online shopping behaviour
PDF
E-commerce customer behavior analysis
PPT
Chp 7 online customer behavior
Unit 1 LO2 - Audience Profiling PowerPoint
Behavioral targeting
The Role of the Internet and New Media on Consumer and Firm Behavior
Making search better by tracking & utilizing user search behavior
Basics of Behavioral Targeting
Web Usage Pattern
E Marketing Ch7 Consumer Behavior
Chapter 6 e-marketing research
Consumer Behavior
Ec2009 ch04 consumer behavior
Online Consumer Behavior
How media producers define their target audience
Audience Profiling Powerpoint
customer behavior in e-commerce
User Behavior Tracking with Google Analytics, Garb, and Vanity
Online shopping behaviour
E-commerce customer behavior analysis
Chp 7 online customer behavior
Ad

Similar to AnDevCon - Tracking User Behavior Creatively (20)

PDF
All about engagement with Universal Analytics @ Google Developer Group NYC Ma...
PDF
Google Analytics intro - Best practices for WCM
PDF
GTUG Philippines - Implementing Google Analytics - 2011-10-11
PDF
Droid con2013 tracking user behavior_tennyson_manheim
PPTX
What is going on? Application Diagnostics on Azure - Copenhagen .NET User Group
PDF
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
PDF
Hi5 Hackathon Presentation
PPTX
Introduction to Firebase [Google I/O Extended Bangkok 2016]
PDF
Cross Device Tracking - Thomas Danniau
KEY
Integrating Google Analytics in Android apps
PPTX
Jack borden jb471909_segment
PDF
High Availability by Design
PDF
Government Web Analytics
PPTX
Google’s tridente
PPTX
Bootstrapping an App for Launch
PDF
Open Social Presentation - GSP West 2008
PPTX
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
PPTX
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
PPT
Advanced Web Development
PDF
The Big Picture and How to Get Started
All about engagement with Universal Analytics @ Google Developer Group NYC Ma...
Google Analytics intro - Best practices for WCM
GTUG Philippines - Implementing Google Analytics - 2011-10-11
Droid con2013 tracking user behavior_tennyson_manheim
What is going on? Application Diagnostics on Azure - Copenhagen .NET User Group
DevFest Kuala Lumpur - Implementing Google Analytics - 2011-09-29.ppt
Hi5 Hackathon Presentation
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Cross Device Tracking - Thomas Danniau
Integrating Google Analytics in Android apps
Jack borden jb471909_segment
High Availability by Design
Government Web Analytics
Google’s tridente
Bootstrapping an App for Launch
Open Social Presentation - GSP West 2008
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
Advanced Web Development
The Big Picture and How to Get Started
Ad

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PPTX
Programs and apps: productivity, graphics, security and other tools
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
MIND Revenue Release Quarter 2 2025 Press Release
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Programs and apps: productivity, graphics, security and other tools

AnDevCon - Tracking User Behavior Creatively

  • 1. Tracking User Behavior Creatively Kiana Tennyson AnDevCon V May 2013
  • 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 in Huffington Post.
  • 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. What is User Tracking? ™  Logging characteristics about the the user and the user’s actions ™  More granular study than Web Analytics ™  Sticky subject! ™  Public apps… highest priority == user permission ™  Internal apps/corporate phones… different rules apply
  • 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. User Story ™  Web Analytics and User Tracking are meant to tell the story of our user(s)
  • 7. Common Analytics Software SAAS ™  Google Analytics ™  Webtrends (paid) BYOH ™  Open Web Analytics ™  Piwik ™  SnowPlow ™  But…
  • 8. Why not Analytics Sites? ™  No outsourcing ™  Extra needs/historical data ™  Company policy ™  Sensitive data
  • 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 web domains
  • 10. Google Analytics Platform Overview source: www.Google-Analytics.com
  • 11. Google Analytics Workflow ™  Workflow (ga.js): 1.  Browser requests page containing tracking code 2.  _gaq array holding tracking commands created 3.  GA source code is fetched and loaded 4.  Commands on _gaq array executed, tracking obj built 5.  Script element loaded to DOM 6.  Tracking obj collects data (via gif request) 7.  Gif request used for logging, data coll., post-processing
  • 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 and ACCESS_NETWORK_STATE permissions
  • 13. GA for Android Workflow ™  Workflow: 1.  tracker.trackEvent(…) called 2.  event is put in localized SQLLite database on device as a “Hit” 3.  At prescribed interval, dispatch occurs of collected data 4.  tracker grabs “Hits” from local db 5.  Sends them to NetworkDispatcher, which in turn posts an AsyncDispatchTask on a thread Handler 6.  Handler sends hits over an HTTP connection via pipeLinedRequestor 7.  When complete, callbacks are invoked, which sets a flag true indicating the dispatcher is reopened for business
  • 15. google_analytics_v2.db Connection ™  Staging area for tracking data located on device ™  Next stop: Google Analytics servers ™  Command line access: ™  From platform-tools directory, open Android Debug Bridge (adb) ™  adb -s emulator-5554 shell #example command ™  sqlite3 google_analytics[_v2].db ™  Begin issuing sqlite commands
  • 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! ™  |http://www.google-analytics.com/collect! ™  |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&cd=com.kt.kbp.flickr.FlickrActivity! google_analytics_v2.db The Table
  • 18. Basic Interaction Types (Classic and Android) ™  Page View Tracking ™  Event Tracking ™  Ecommerce/Transaction Tracking ™  Custom Dimensions/Metrics ™  Timing, Social, Exception…
  • 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. 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(R.id.helpLink);! 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. Event Tracking ™  Event tracking logs user interaction with the app ™  Button/link clicks, viewing a video, anything ™  Anything passed into GoogleAnalyticsTracker appears on the reporting interface (be consistent) ™  Category ™  Action ™  Label (opt) ™  Value (opt) ™  Category/Action pairs should be unique
  • 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(R.id.videoLink);! videoLink.setOnClickListener(new OnClickListener() {! ! @Override! public void onClick(View view) {! tracker.sendEvent(“Videos”, “Play”, videoId, 0);! //initiate video playback! }! }! }! }! Event Tracking
  • 23. Ecommerce Tracking ™  Track shopping carts and in-app purchases ™  Additional classes required to track transactions: ™  Transaction ™  Item ™  Process goes: 1.  Create Transaction Object 2.  Add Items to Transaction 3.  Submit Transaction to Analytics Servers
  • 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 Tracking Step 1 Step 2 Step 3
  • 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. 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 event tracking onClick() ™  Track a user’s navigation session through your app
  • 28. External Data Integration ™  Compare brick and mortar shops with mobile traffic vicinity ™  Compare app activity to desktop site activity ™  Correlate high/low volume usage with external user statistics ™  Customize dashboards that include GA data
  • 29. GA Reporting Framework Account Property Profile Report Profile Report Property Profile Report Report Property – website, blog, app Profile – A version of the property (Android, iOS, Blackberry) Query the profile tables via the Core Reporting API using the profile id
  • 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. 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. 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. https://www.googleapis.com/analytics/v2.4/data ?ids=12345 &dimensions=ga:customVarValue5 &metrics=ga:visits &filters=ga:daysSinceLastVisit%3E%3D5 &start-date=2013-05-01 &end-date=2013-05-30 &max-results=50 (Where customVarValue5 == salesRepId) Select visits, customVarValue5 from 12345 where daysSinceLastVisit <= 5 and startDate => ‘2013-05-01’ and endDate <= ‘2013-05-30’ group by customVarValue5 limit 0, 50 Sample Query
  • 34. Compared to SQL Additionally: Can sort by Metrics *and* Dimensions J Cannot query across profile-ids L GA Query Metrics Dim. Profile ID Filters SQL QuerySelect Col. Group By From (Table) Where
  • 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. Metrics ™  Common ones ™  visitors ™  timeOnSite ™  organicSearches ™  adClicks ™  goal(N)Completions ™  Interesting ones ™  serverConnectionTime ™  domainLookupTime ™  redirectionTime ™  exceptions ™  uniqueSocialInteractions
  • 37. Dimensions ™  Common ones ™  visitorType ™  campaign ™  city/metro/region ™  searchUsed ™  language ™  Interesting ones ™  customVarName(N) ™  mobileDeviceModel ™  hostname ™  nthMonth/Week/Day
  • 38. Output ™  JSON response format ™  Client Libraries available ™  Java, Python, Objective-C, Javascript ™  Just use your favorite Json Parser Library
  • 40. Who? ™  Know your user ™  By Individual – Corporate app that needs to track representative use in the field ™  By Demographic – Publically downloaded game catering 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. 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. GA – Answering “Who” ™  All tracking calls intrinsically collect visitor information ™  Decide what to query for ™  ga:visitors ™  ga:visitorType (new or returning) ™  ga:source (indirectly related to user) ™  ga:userActivityUserHandle
  • 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:
  • 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. 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 leading to conversion or transaction
  • 47. User Tracking – “What” ™  Logging app usage via Singletons or local db inserts ™  Strategy determined by UI ™  Multiple Activity Structure – activity lifecycle drawbacks ™  Single Activity/Multi Fragment – lifecycle benefits
  • 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 usage times
  • 50. GA – Answering “When” ™  No metrics correlating time and user activity ™  Dimensions to query for actions around specified times do 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. 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 end of dispatch period
  • 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. GA – Answering “Where” ™  No metrics to correlate geolocation to activity ™  Dimensions exist; collected from IP Address during HTTP Requests ™  ga:continent down to ga:latitude/longitude, etc
  • 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 with other tracking data
  • 57. Why? ™  When users convert and complete goals, it is easy to answer “Why” ™  When users are NOT participating in goal conversion/ completion, ™  Focus research on pageViews ™  Focus on events occurring on the higher rated pageViews
  • 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 its potential
  • 59. User Tracking – “Why’’ ™  Too subjective for User Tracking
  • 60. Wrap Up ™  Mobile devices are quickly becoming one of the most commonly used personal computers ™  Understand the boundaries of user privacy ™  Protect our users; they keep us “in business” J