Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
讓你的聊天機器人也能看 Google Analytics @ chatbot.tw 台中 20...
Search
戴均民
November 06, 2019
Programming
71
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
讓你的聊天機器人也能看 Google Analytics @ chatbot.tw 台中 2019/11
戴均民
November 06, 2019
More Decks by 戴均民
See All by 戴均民
Flex 開發人員工具:一個輔助開發 LINE chatbot 的開源工具
taichunmin
0
86
Flex 開發人員工具:一個輔助開發 LINE chatbot 的開源工具
taichunmin
0
430
簡單打造吸睛的圖+文傳單 | LINE電子傳單
taichunmin
0
260
LINE 數位版名片介紹
taichunmin
0
1.1k
能使用變數的訊息推送小工具 @ chatbot.tw 台中 2019/12
taichunmin
0
100
SERVEO 讓你用 Docker 開發 chatbot 也能過的去 @ COSCUP 2019
taichunmin
0
270
你應該要把沒用的 commit 壓扁 @ 微程式 2019/05/23
taichunmin
0
130
大學程式能力檢定 (CPE) 2017/03/28 成果報告 中山大學資訊工程系 楊昌彪 教授
taichunmin
0
180
Other Decks in Programming
See All in Programming
Domain-Driven Transformation
hschwentner
2
2.3k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
気持ちぃ〜角丸 Squircle
ryu1013
0
310
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
920
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
Jetpack Compose Mechanisms
skydoves
3
820
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
433
67k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Building Adaptive Systems
keathley
44
3.2k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
480
Agile that works and the tools we love
rasmusluckow
331
22k
Designing for humans not robots
tammielis
254
26k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
The Cost Of JavaScript in 2023
addyosmani
55
10k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
560
Transcript
讓你的聊天機器⼈也能看 讓你的聊天機器⼈也能看 Google Analytics Google Analytics 簡報: 簡報: https://lihi1.com/PGYr0 https://lihi1.com/PGYr0
1 1
Who am I? Who am I? 戴均⺠ 戴均⺠ 現職 現職
微程式資訊 微程式資訊 後端⼯程師 後端⼯程師 taichunmin taichunmin 2 2
YouBike ⼩幫⼿ YouBike ⼩幫⼿ 站點查詢 站點查詢 ⾏程規劃 ⾏程規劃 最愛場站 最愛場站
3 3
有件事要請⼤家配合 有件事要請⼤家配合 4 4
⼩幫⼿的 GA 後台 ⼩幫⼿的 GA 後台 請⼤家 請⼤家不要拍照錄影 不要拍照錄影 5
5
緣起 緣起 6 6
原本只是要在 LIFF 裡⾯埋 GA 原本只是要在 LIFF 裡⾯埋 GA 7 7
原本只是要在 LIFF 裡⾯埋 GA 原本只是要在 LIFF 裡⾯埋 GA 然後就去研究了 GA
的文件 然後就去研究了 GA 的文件 8 8
9 9
10 10
於是我就⾃⼰挖了⼀個坑 於是我就⾃⼰挖了⼀個坑 11 11
於是我就⾃⼰挖了⼀個坑 於是我就⾃⼰挖了⼀個坑 然後再⾃⼰把坑填掉 然後再⾃⼰把坑填掉 12 12
⼩幫⼿ GA 後台展⽰ ⼩幫⼿ GA 後台展⽰ 請⼤家 請⼤家不要拍照錄影 不要拍照錄影 13
13
後台展⽰ 後台展⽰ ⽬標對象 > 總覽 ⽬標對象 > 總覽 ⽬標對象 >
使⽤者多層檢視 ⽬標對象 > 使⽤者多層檢視 ⾏為 > 畫⾯ ⾏為 > 畫⾯ ⾏為 > ⾏為流程 ⾏為 > ⾏為流程 14 14
Measurement API 介紹 Measurement API 介紹 15 15
hit hit ⽤⼾跟程式的互動資料 ⽤⼾跟程式的互動資料 16 16
使⽤ HTTP 協定就能傳送 hit 使⽤ HTTP 協定就能傳送 hit 17 17
申請 Google Analytics 申請 Google Analytics 18 18
建立資源 建立資源 19 19
20 20
建立資料檢視 建立資料檢視 21 21
Collect API Collect API 22 22
hit 中的必填欄位 hit 中的必填欄位 23 23
匿名 Client ID (cid) 匿名 Client ID (cid) 這個欄位必須是⼀個 這個欄位必須是⼀個亂數
UUID v4 亂數 UUID v4 如果在請求中未指定 如果在請求中未指定 uid uid 欄位,則 欄位,則 cid cid 就是必填欄位。 就是必填欄位。 cid cid 可以匿名識別⼀個特定的⽤⼾、裝置或瀏覽器。在 可以匿名識別⼀個特定的⽤⼾、裝置或瀏覽器。在 web 模式中,通常會把 web 模式中,通常會把 cid cid 存在有兩年有效期限的第⼀⽅ 存在有兩年有效期限的第⼀⽅ Cookie 中。在 app 模式中, Cookie 中。在 app 模式中,cid cid 應該要在安裝時隨機產 應該要在安裝時隨機產 ⽣。這個欄位必須是⼀個亂數 UUID v4。 ⽣。這個欄位必須是⼀個亂數 UUID v4。 24 24
匿名 Client ID (cid) 匿名 Client ID (cid) 25 25
screenview hit screenview hit 26 26
實際送出的 screenview 實際送出的 screenview z= z=1572869089464 1572869089464 &aip= &aip=1 1
&an=YouBike%20LINE%40 &an=YouBike%20LINE%40 &av= &av=0 0. .1.0 1.0 &cd=Nearby%20Station%3A%20Result &cd=Nearby%20Station%3A%20Result &cid= &cid=03 039423df- 9423df-7421 7421- -16 16d5-ee31- d5-ee31-878 878c9dfeb11b c9dfeb11b &de=UTF- &de=UTF-8 8 &ds=app &ds=app &t=screenview &t=screenview &tid=UA-XXXXX-Y &tid=UA-XXXXX-Y &uid=U039423df742116d5ee31878c9dfeb11b &uid=U039423df742116d5ee31878c9dfeb11b &ul=zh-tw &ul=zh-tw &v= &v=1 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 27 27
GA 即時畫⾯ GA 即時畫⾯ 請⼤家 請⼤家不要拍照錄影 不要拍照錄影 28 28
event hit event hit 29 29
實際送出的 event 實際送出的 event z= z=1572869089467 1572869089467 &aip= &aip=1 1
&an=YouBike%20LINE%40 &an=YouBike%20LINE%40 &av= &av=0 0. .1.0 1.0 &cid= &cid=03 039423df- 9423df-7421 7421- -16 16d5-ee31- d5-ee31-878 878c9dfeb11b c9dfeb11b &de=UTF- &de=UTF-8 8 &ds=app &ds=app &ea=Nearby%20Station%20Banner &ea=Nearby%20Station%20Banner &ec=Ad%20Impression &ec=Ad%20Impression &el=%E6%81%B0%E8%BF%B7%E9%80%A2%E7%94%B220191022%E5%88%B0 &el=%E6%81%B0%E8%BF%B7%E9%80%A2%E7%94%B220191022%E5%88%B0 &t=event &t=event &tid=UA-XXXXX-Y &tid=UA-XXXXX-Y &uid=U039423df742116d5ee31878c9dfeb11b &uid=U039423df742116d5ee31878c9dfeb11b &ul=zh-tw &ul=zh-tw &v= &v=1 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 30 30
CAVEAT CAVEAT Event 必須在 Screenview 之後 Event 必須在 Screenview 之後
否則這些 Event 會被忽略 否則這些 Event 會被忽略 31 31
GA 即時事件 GA 即時事件 請⼤家 請⼤家不要拍照錄影 不要拍照錄影 32 32
驗證 hit 正確性 驗證 hit 正確性 hit 測試⼯具 hit 測試⼯具
常⾒的 hit 範例 常⾒的 hit 範例 hit 參數參考文件 hit 參數參考文件 33 33
⽤量限制 (單位: hit) ⽤量限制 (單位: hit) 1000 萬 / ⽉
/ 追蹤 ID 1000 萬 / ⽉ / 追蹤 ID 20 萬 / 天 / ⽤⼾ 20 萬 / 天 / ⽤⼾ 500 / ⼯作階段 500 / ⼯作階段 34 34
GA 批次發送 GA 批次發送 35 35
GA 批次發送限制 GA 批次發送限制 ⼀次最多 20 個 hits ⼀次最多 20
個 hits POST body 不⼤於 16 KB POST body 不⼤於 16 KB 單⼀ hit 不⼤於 8 KB 單⼀ hit 不⼤於 8 KB 36 36
累積 20 個 hits 再⼀起送出去 累積 20 個 hits 再⼀起送出去
是 是 否 否 有 hit 需要送出 有 hit 需要送出 將 hit 存到 Redis 中 將 hit 存到 Redis 中 取得 Redis 中的 hit 數量 取得 Redis 中的 hit 數量 hits >= 20 ? hits >= 20 ? 取出最多 20 個 hits 取出最多 20 個 hits 計算 qt 計算 qt 送出 hits 送出 hits 結束 結束 37 37
定期把放太久的 hits 送出去 定期把放太久的 hits 送出去 是 是 否 否
每分鐘的 cron job 每分鐘的 cron job 取得 Redis 中的 hit 數量 取得 Redis 中的 hit 數量 hits >= 0 ? hits >= 0 ? 取出最多 20 個 hits 取出最多 20 個 hits 計算 qt 計算 qt 送出 hits 送出 hits 結束 結束 38 38
Queue Time (qt) Queue Time (qt) 因為放在 Queue 中的 hit
不會被⾺上送出 因為放在 Queue 中的 hit 不會被⾺上送出 所以需要告知 hit 被放在 queue 中放了多久 所以需要告知 hit 被放在 queue 中放了多久 39 39
Batch API Batch API POST POST /batch /batch HTTP/1.1 HTTP/1.1
Host Host: www.google-analytics.com : www.google-analytics.com z= z=1572869089464 1572869089464&aip= &aip=1 1&an=YouBike%20LINE%40&av= &an=YouBike%20LINE%40&av=0 0. .1.0 1.0&de=UT &de=UTF z= z=1572869089467 1572869089467&aip= &aip=1 1&an=YouBike%20LINE%40&av= &an=YouBike%20LINE%40&av=0 0. .1.0 1.0&de=UT &de=UTF 1 1 2 2 3 3 4 4 5 5 40 40
GA 即時畫⾯ GA 即時畫⾯ 請⼤家 請⼤家不要拍照錄影 不要拍照錄影 41 41
Q & A Q & A 42 42