![Page 1: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/1.jpg)
Kiana Tennyson
DroidCon Berlin
April 2013
TRACKING USER BEHAVIOR CREATIVELY
![Page 2: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/2.jpg)
WHO IS KIANA? • Software Engineer – Manheim
• Highest volume operator of wholesale auto auctions in the world
• Professional background… web portals, data aggregation
• 2013 goal – contribute to an open source project (maybe WebRTC?)
• Occassional blogging… shecodes.blogspot.com
• Find me on twitter @kiaaaana
![Page 3: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/3.jpg)
DISCLAIMER: • IS a Feasibility Discussion
• NOT an Ethics Discussion
• NOT a Security Discussion
• Don’t go to jail, get sued or end up defamed
• Ultimately, let’s take care of our users (so they will pay us)
![Page 4: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/4.jpg)
OVERVIEW • Difference between Web Analytics and User Tracking
• Google Analytics
• Data Collection
• Data Transferal Strategy
• Data Querying using Core Reporting API
![Page 5: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/5.jpg)
• Logging characteristics about 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
• Collection, analysis, reporting of internet data
• Two categories – onsite and offsite
• Two data collection methods
• Log file analysis
• Page tagging
ANALTYICS VS USER TRACKING
Analytics User Tracking
![Page 6: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/6.jpg)
INTERACTION TYPES (CLASSIC AND ANDROID)
• Pageview Tracking
• ”Activity” (aka page) requests
• Essentially wherever requests for a new view is made
• Event Tracking
• Layout interactions initiated by user
• Ecommerce Tracking
• Track average transactions and in-app purchases
• Custom Variables, Dimensions, Metrics
![Page 7: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/7.jpg)
PAGEVIEW TRACKING public class TestPage extends Activity {! @Override!
protected void onCreate(Bundle savedInstanceState) {!
...!
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();!
tracker.startNewSession(“UA-XXXXX-YY”, this);!
TextView helpLink = (TextView)findViewById(R.id.helpLink);!
helpLink.setOnClickListener(new OnClickListener() {!
@Override!
public void onClick(View view) {!
tracker.sendView(“/helpPage”);!
startActivity(new Intent(TestPage.this, HelpPage.class));!
}!
}!
}!
}!
![Page 8: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/8.jpg)
EVENT TRACKING public class VideoPage extends Activity {! @Override!
protected void onCreate(Bundle savedInstanceState) {!
...!
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();!
tracker.startNewSession(“UA-XXXXX-YY”, this);!
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!
}!
}!
}!
}!
![Page 9: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/9.jpg)
ECOMMERCE TRACKING public class PurchasePage extends Activity {!
. . . !
public void onPurchaseConfirmed(Purchase purchase) {!
!
Transaction transaction = initTransaction(purchase);!
!
transaction.setStoreName(Constants.STORE_NAME);!
transaction.setShippingCost(purchase.getShippingCost());!
transaction.setTotalTax(purchase.getTotalTax());!
tracker.addTransaction(transaction);!
!
for(LineItem lineItem : purchase.getLineItems() {!
!tracker.addItem(createNewItemBuilder(purchase,lineItem).build()!
}!
tracker.sendTransactions();!
}!
}!
Step 1
Step 2
Step 3
![Page 10: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/10.jpg)
CUSTOM VARIABLES public class PurchasePage extends Activity {! . . .!
public void onSubscriptionComplete(Subscription subscription) {!
boolean complete = subscriptionProcessor.process(subscription);!
if (complete) {!
//Track new subscription sold at session level!
tracker.setCustomVar(1, “New Subscription”, salesRepId, 2);!
trackTransaction(tracker, subscription);!
}!
listener.notify(subscription, complete);!
}!
!
! index name value scope (default page-level)
![Page 11: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/11.jpg)
OTHER INTERACTION TYPES • Social Interactions
• tracker.sendSocial(network, action, target)!
• Timings
• tracker.sendTimings(interval, category, name, label)!
• Custom Dimensions/Metrics
• tracker.setCustomDimension(index, scope)!
![Page 12: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/12.jpg)
USER STORY
• Web Analytics and User Tracking tell a story about our user(s)
![Page 13: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/13.jpg)
• Secure.ANDROID_ID (Has limitations)
• TelephonyManager
• getSimSerialNumber()
• getDeviceId()
• Build.Serial (Good for tablets)
• Company-assigned ID
• All tracking calls collect user info
• Metrics for Core Reporting API:
• ga:visitors
• ga:visitorType
• ga:source
• ga:userActivityHandle
WER (WHO)?
Google Analytics User Tracking
![Page 14: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/14.jpg)
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)
![Page 15: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/15.jpg)
• Logging app usage via Singletons or local db inserts
• Define start and end points
• Strategy determined by UI
• Multiple Activity Structure – activity lifecycle drawbacks
• Single Activity/Multi Fragment – lifecycle benefits
• 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
WAS (WHAT)?
Google Analytics User Tracking
![Page 16: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/16.jpg)
• 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
• No metrics correlating time and user activity
• Dimensions (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) !
WANN (WHEN)?
Google Analytics User Tracking
![Page 17: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/17.jpg)
• Log location with android.location package
• 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
• No metrics to correlate geolocation to activity
• Dimensions exist; collected from IP Address during HTTP Requests
• ga:continent down to ga:latitude/longitude, etc
WO (WHERE)?
Google Analytics User Tracking
![Page 18: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/18.jpg)
• 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
WARUM (WHY)?
Google Analytics AND User Tracking
![Page 19: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/19.jpg)
GA DATA COLLECTION
Google Analytics Tracker
Event (Hit)
SQLLite Database
Network Dispatcher
Dispatch Handler
AsyncDispatch Task
Pipelined Requestor
Http Connection
Callbacks
(start)
(end)
![Page 20: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/20.jpg)
USER TRACKING DATA COLLECTION • Write a Custom ContentProvider and SyncAdapter
• Requires user permission (removing your liability)
• Handles network availability, scheduling and interrupts
![Page 21: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/21.jpg)
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
![Page 22: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/22.jpg)
SAMPLE QUERY (CORE REPORTING API) https://www.google.com/analytics/feeds/data ?ids=12345 &dimensions=ga:customVarValue5 &metrics=ga:visits &filters=ga:daysSinceLastVisit%3E%3D5 &start-date=2012-11-23 &end-date=2012-12-07 &max-results=50 (Where customVarValue5 == salesRepId) Select visits, customVarValue5 from 12345 where daysSinceLastVisit <= 5 and startDate => ‘2012-11-23’ and endDate <= ‘2012-12-07’ group by customVarValue5 limit 0, 50
![Page 23: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/23.jpg)
COMPARED TO SQL
GA Query
Metrics Dim.
Profile ID Filters
SQL Query Select
Col.
Group By
From (Table)
Where
![Page 24: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/24.jpg)
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
![Page 25: Droid con2013 tracking user behavior_tennyson_manheim](https://reader034.vdocuments.site/reader034/viewer/2022052505/554d2a97b4c905c5208b50a9/html5/thumbnails/25.jpg)
QUESTIONS? Thank you….