Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using D3.js to visualise your analytics data
Search
Edd S
October 21, 2013
Technology
780
0
Share
Using D3.js to visualise your analytics data
Learn how to create easy hacks to create graphs of your users behaviour with D3.
Edd S
October 21, 2013
More Decks by Edd S
See All by Edd S
Using React at Deliveroo - LRUG
edds
0
880
Accessibility and how to get the most from your screenreader - EpicFEL
edds
1
620
What even is a table? A quick look at Accessibility APIs
edds
8
2.6k
Accessibility and how to get the most from your screenreader - Pivotal Lunch & Learns
edds
2
440
Accessibility and how to get the most from your screenreader - Front End North
edds
3
1.3k
GOV.UK Case Study - Fronteers 2013
edds
2
1.1k
Using Sass on GOV.UK
edds
8
970
What the flash - Photography Introduction
edds
67
11k
HTML5
edds
11
1.9k
Other Decks in Technology
See All in Technology
Spring AI × MCP 入門〜AIエージェントへのツール公開、境界設計から始める最小構成 〜
yuyamiyamoto
0
210
さきさん文庫の書籍ができるまで
sakiengineer
0
340
Strands Agents超入門
kintotechdev
1
160
新規事業を牽引する技術選定 〜フルスタックTypeScript開発の実践事例〜
nullnull
2
260
個人最適 から 全体最適 へ AI情報共有会・AIギルド・AI-DLC で進める カンリーの組織展開
rfdnxbro
0
1k
ルールやカスタム機能、どう使う?理想の出力を引き出すために今知りたいIBM Bob 5つの機能
muehara
1
310
はじめてのDatadog
kairim0
0
260
新規ゲーム開発におけるAI駆動開発のリアル
202409e2
0
2.1k
個人AIからチームAIへ:開発における品質と生産性の再設計
moongift
PRO
0
370
最低限これだけ押さえれ大丈夫_Claude Enterprise/Team企業展開ガバナンス入門
tkikuchi
1
710
Sony_KMP_Journey_KotlinConf2026
sony
2
210
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
430
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Scaling GitHub
holman
464
140k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
190
The Cost Of JavaScript in 2023
addyosmani
55
10k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
480
We Have a Design System, Now What?
morganepeng
55
8.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
380
Game over? The fight for quality and originality in the time of robots
wayneb77
1
190
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
370
Transcript
Edd Sowden @edds
D3.js
[ ... ]
Sin Wave
[ 0, 1, 0, -1, 0 ]
var xScale = d3.scale .linear() .domain([0, data.length-1]) .range([0, graphWidth]);
d3.svg.line() .x(function(d, i){ return xScale(i); }) .y(function(d, i){ return yScale(d);
});
demo
[ [ ... ], [ ... ] ]
D3 update pattern
// select all existing elements ... // add new elements
... // update all the elements ... // remove the old elements ...
// select all existing elements lines = graph.selectAll(‘path’) .data(data)
// add new elements lines.enter().append(‘path’)
// update all the elements lines.attr('d', function(d){ return line(d); });
// remove the old elements path.exit().remove();
demo
Updating the lines
demo
Google Analytics
app google window.location (query string) window.location (hash) JSONP (Ajax)
accessToken
https://www.googleapis.com/ analytics/v3/management/accounts
googleUser.apiRequest( endpoint, function(data){ ... } );
Dimensions Metrics Sort order Start and end date
Dimensions Metrics Sort order Start and end date
Dimensions Metrics Sort order Start and end date
Dimensions Metrics Sort order Start and end date
OLAP Cube
date device type operating system
operating system date device type
metrics ga:visitors dimensions ga:deviceCategory ga:nthDay
https://www.googleapis.com/analytics/v3/data/ga? ids={{profileId}}& dimensions=ga:nthDay,ga:deviceCategory& metrics=ga:visitors& start-date=2013-01-01& end-date=2013-09-30& max-results=10000& sort=ga:nthDay& access-token={{accessToken}}
[ [desktop, 0, 7], [mobile, 0, 3], [tablet, 0, 7],
[desktop, 1, 4], ... ]
[ { type: “desktop”, values: [7, 4, 5], }, ...
]
demo
Getting the data in shape
demo
Browser Matrix http://edds.github.io/browser-matrix/
None
Google Analytics Query Explorer 2 http://ga-dev-tools.appspot.com/explorer/
Demos from this talk https://github.com/edds/d3-presentation-examples
Edd Sowden @edds