In this talk I discuss discuss ways that you can use the new version of Google Analytics (universal analytics) to measure the REAL engagement of your users, create new custom dimensions & metrics, track off site activities in Google Analytics and ways to track the same user across devices.
27. Event tracking is a GA method
that tracks engagement. It
consists of four values that
you can use to describe a
user's interaction
Value Type Required Description
Category String Yes Typically the object that was interacted with (e.g. button)
Action String Yes The type of interaction (e.g. click)
Label String No Useful for categorizing events (e.g. nav buttons)
Value Number No Values must be non-negative. Useful to pass counts (e.g. 4
times)
28. Example Button Click
<button id="b1">Click Me</button>
<script>
$('#b1').click(function(){
ga('send', // send command - REQUIRED
'event', // type of thing to send - REQUIRED
'category', // category of event - REQUIRED
'action', // action of the event - REQUIRED
'label', // the element that was clicked - OPTIONAL
5 // the value of the event that was clicked - OPTIONAL
);
});
</script>
ga('send','event','category','action','opt_label',opt_value)
29. Don’t forget about
hidden content
Are people
viewing
your tabs?
$('#tabID').click(function(){
ga('send', // send command – REQUIRED
'event', // type of thing to send – REQUIRED
'tabs', // category of event – REQUIRED
'click', // action of the event – REQUIRED
$(this).id, // the element that was clicked - OPTIONAL
);
});
</script>
45. Custom Dimensions
allow you to push
custom data to Google
Analytics and group
things together
Note: You only get 20 but they 1 can have multiple labels
46. Set the Scope
The scope tells GA how
long the custom
dimensions should
follow the user
47. 3 Types of Scope
Hit - value is
applied to the
single hit for which
it has been set.
48. Hit
What authors get viewed viewed the most?
Blog post
1 by Chris
Blog post
2 by Kevin
Blog post
3 by Nico
Blog post
4 by Kevin
Blog post
5 by Chris
Blog post
6 by Nico
Blog Post
7 by Kevin
Pageview=blog-1/ Pageview=/blog-5/ Pageview=/blog-4/ Pageview=/blog-2/
cd1_value=Author_Kevin cd1_value=Author_Nico cd1_value=Author_Kevin
cd1_value=Author_Kevincd1_value=Author_Nicocd1_value=Author_Chris
cd1_value=Author_Chris
Pageview=/blog-7/Pageview=/blog-2/Pageview=/blog-4/
49. Processing
Every hit gets processed with the Custom Dimension of the author’s name
ClientID = 232
Session 1
H1: pageview=/blog-post-1/ cd1_value=Author_Chris
H2: pageview =/blog-post-5/ cd1_value=Author_Kevin
ClientID = 343
Session 1
H1: pageview =/blog-post-4/ cd1_value=Author_Nico
H2: pageview =/blog-post-2/ cd1_value=Author_Kevin
H3: pageview =/blog-post-7/ cd1_value=Author_Chris
H4: pageview =/blog-post-6/ cd1_value=Author_Nico
H5: pageview =/blog-post-9/ cd1_value=Author_Kevin
51. 3 Types of Scope
Session - value is
applied to all hits in a
single session where
idle time is < 30 mins.
52. Session
Do people who watch my videos end up converting?
Go product
page
Watch
video
Click on
tabs
Read
reviews
Sign up
Pageview=blog-1/ event= video, play, video1 event= tabs, click, info
Pageview=reviews/ event = forms, sign up, more info
Remember event tracking parameters = category, action, label
Cd2 = video watcher
Cd2 = video watcher
Video event triggers
custom dimension 2
53. 3 Types of Scope
User - value is applied to all
hits in current and future
sessions, until value changes
or custom dimension is made
inactive.
54. Users
How do the paid users differ from the free users
Go to
site
Log in
View
blog
Listen to
music
Go to site
View help
page
View blog
Listen to
music
Pageview=/ Pageview = welcome Pageview= /blog/ event= music, play, song1
Pageview=/ Pageview=/help/ Pageview=/blog/ event= music, play, song2
Cd3 = video watcher
Cd3 = video watcher
Session 1
Session 2
55. But what if they switch to
another device
Woz’s
travel bag
60. It starts with User-ID
feature
- The user ID lets you create your own
persistent anonymous id and override GA’s
- You can tie hits & sessions to the same
users when they log in on different devices
61. It starts with User-ID feature
Make sure the User ID is:
- Non-personally identifiable
- Unique to a user of your service or
app
- Persistent for a
signed-in user across
all devices
Web:
ga('create', 'UA-XXXX-Y', 'auto');
if (auth.userSignedInVlaue) {
ga('set', '&uid', {{ USER_ID }});
};
ga('send', 'pageview');
Android:
t.set("&uid", {{ USER_ID }});
iOS:
[tracker set:@"&uid" value:{{ USER_ID
}}];
62. Setting it up in the App
- Enable
UserID
in Admin
- Make a new
View
63. Things to note:
1- the profile will only show hits with the
UserID present
2- number of Users is calculated based on
the number of unique User-ID values.
3- date range max will only be 90 days
4- Once you enable the User ID feature for
a view (profile), you cannot disable it.
64. What can we learn from that?
Where your customers
research and where
they buy & how their
activity differs
65. What can we learn from
that?
We can
see
device
overlap
reports
69. The measurement protocol lets you
send data to Google Analytics via
HTTP Requests to this endpoint.
http://www.google-analytics.com/collect
http://ssl.google-analytics.com/collect
With these values required for all hits
Name Parameter Example Description
Protocol Version v v=1 The protocol version. The
value should be 1.
Tracking ID tid tid=UA-123456-1 The ID that distinguishes to
which Google Analytics
property to send data.
Client ID cid cid=xxxxx An ID unique to a particular
user.
Hit Type t t=pageview The type of interaction
collected for a particular
user.
74. Rasberry Pi + PIR Sensor +
lil’ Python = movement in GA
import time
import urllib2
import RPi.GPIO as io
io.setmode(io.BCM)
pir_pin = 18
io.setup(pir_pin, io.IN
def hitGA():
urllib2.urlopen("http://ww
w.google-
analytics.com/collect?v=1&
tid=UA-XXXXXX-
Y&cid=1111&t=event&ec=Move
ment&ea=livingRoom&el=desk
").close
while True:
if io.input(pir_pin):
hitGA()
Total cost $60
80. Client ID or User ID
Question Client ID User ID
What does the ID
Represent?
An anonymous device or browser instance. A single user, like a signed-in user account, that may interact with
content across one or more devices and / or browser instances.
How is the ID Set? Randomly generated and automatically sent
with all hits by Google Analytics libraries.
You must set and send your own userIds with your Google Analytics
hits.
How is ID Used to
Calculate Unique
Users?
In a non-User-ID-enabled view (profile), Client
ID is used to calculate unique users.
In a User-ID-enabled view (profile), User ID is used to calculate unique
users
There are two ways to associate a hit
to a user with the measurement
protocol
Examples: Lead gen vs eComm
82. The lead gen process
Go to site
Browse
around
Fill out form
Form goes to
DB
BizDev
follows up
with call
Lead turns to
Qualified
BizDev sends
proposal
Client signs
agreement
New Lead
Nico
Miceli
CompanyX
.com
83. What GA sees
Go to site
Browse
around
Fill out form
Form goes to
DB
BizDev follows
up with call
Thumbs Up!
Lead turns to
Qualified
BizDev sends
proposal
Client signs
agreement
New Lead
Nico
Miceli
CompanyX
84. Push the client ID with
your form
submissions… hindenly
<form id="lead-form" method="POST" action="/lead">
<input id="name" type="text" /><BR>
<input id="phone" type="text" /><BR>
<!-- make a hidden input field and store the client ID in it -->
<input id="clientcookie" type="hidden" /><BR>
</form>
<script type="text/javascript">
$(document).ready(function(){
ga(function(tracker) {
clientID = tracker.get('clientId'); //grab the current users anonymous client ID
document.getElementById('clientcookie').value = clientID;
//set the value of client ID to the hidden input field
});
});
</script>
85. ga(function(tracker) {
var clientId = tracker.get('clientId');
});
<form id="lead-form" method="POST" action="/lead">
<input id="name" type="text" /><BR>
<input id="phone" type="text" /><BR>
<!-- make a hidden input field and store the client ID in it -->
<input id="clientcookie" type="hidden" /><BR>
</form>
<script type="text/javascript">
$(document).ready(function(){
ga(function(tracker) {
clientID = tracker.get('clientId'); //grab the current users anonymous client ID
document.getElementById('clientcookie').value = clientID;
//set the value of client ID to the hidden input field
});
});
</script>
86. The lead gen process
Go to site
Browse
around
Fill out form
Form goes to
DB
BizDev
follows up
with call
Lead turns to
Qualified
BizDev sends
proposal
Client signs
agreement
New Lead
Nico
Miceli
CompanyX
CID: 777
cid:777 cid:777
cid:777 cid:777
Send new data with the
Measurement protocol
87. Get Email
Go to
eComm.com
Log in to get
coupon
Print Out
Coupon
Go to the
eComm
Store
Spend
coupon +
$100
eComm to comm…
88. Get Email
Go to
eComm.com
Log in to get
coupon
Print Out
Coupon
Go to the
eComm
Store
Spend
coupon +
$100
eComm to comm
auth = true
89. Get Email
Go to
eComm.com
Log in to get
coupon
Print Out
Coupon
Go to the
eComm
Store
Spend
coupon +
$100
eComm to comm
auth = true
UID=123
UID=123 UID=123
90. I can now see user pain
points in my app, learn
the impact of the bells &
whistle, I can understand
the users on across
devices, I can associate
them with real world
data.
91. TL;DR Events
Use Google Analytics to track engagement via JS events
ga('send','event','category','action','opt_label
',opt_value)
92. TL;DR Custom Dimensions
Allows you to group things and send more data to Google
Analytics
Step 1: Create a Name that you want to show up in reports
Step 2: Set the Scope
Step 3: Make it Active
93. TL;DR Cross Device Management
Allows you to track a user across different devices
Step 1: Enable it in the web app
Step 2: Connect a persistent anonymous ID to each user
Step 3: Add it to your code
94. TL;DR measurement Protocol
Allows you to send data to GA via HTTP Requests
Allows you to connect real world with internet world
The length of the entire encoded URL must be no longer than
2000 Bytes.
95. Resources
Google Analytics Debugger Chrome Extension
Google Analytics Developer Google+ Community
Stack Overflow Google Analytics Tag
All links will be on my G+ page
tomorrow
Google.com/+nicomiceli
@nicomiceli