Google Analytics Event Tracking for CRO and UX by Angie Schottmuller
Dynamically track optimization audit data for user behaviors like bounce (ABR) and scrolling along with clicks on tabs, file downloads, jump-to buttons, email address links, phone click-to-call, and external domain links.
/*
Source URL: http://j.mp/gaeventtrackingforcro
Minified Version: http://j.mp/gaeventtrackingforcroMIN
________
_,.-Y | | Y-._
.-~" || | | | "-.
I" ""=="|" !""! "|"[]""| _____
L__ [] |..------|: _[----I" .-{"-.
I___| ..| l______|l_ [__L]_[I_/r(=}=-P
[L______L_[________]______j~ '-=c_]/=-^
\_I_j.--.\==I|I==_/.--L_]
[_((==)[`-----"](==)j \
I--I"~~"""~~"I--I "Conversion optimization is where it's AT-AT!"
|[]| |[]|
l__j l__j
|!!| |!!| GOOGLE ANALYTICS EVENT TRACKING FOR CRO & UX
|..| |..| by Angie Schottmuller, OCT 14, 2014. Last updated: SEP 28, 2015
([]) ([]) May the Force be with you.
]--[ ]--[ Got questions? Send me a tweet: http://twitter.com/aschottmuller
[_L] [_L]
/|..|\ /|..|\
`=}--{=' `=}--{='
.-^--r-^-. .-^--r-^-.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
INSTRUCTIONS: Include a script link to this JavaScript file just before the body end tag. Requires inclusion of Google Universal Analytics (JavaScript inside head tag) and jQuery (linked JS file before body end tag) to be loaded first.
Ensure HTML for all clickable links has a unqiue, intuitive id attribute (id='bottomctabutton') that can be referenced with the logged event.
TIP: This code should ideally be minified to reduce load performance time. Minified source: http://j.mp/gaeventtrackingforcroMIN
*/
/*
READING VIEW TIME -------------------------------------------------------------------------
Purpose: Log user page viewing time at 3, 5 and 15 seconds. Code Author: Angie Schottmuller.
Note: By default, GA recognizes a logged event as an "interaction". As...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.