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
58
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
77
Flex 開發人員工具:一個輔助開發 LINE chatbot 的開源工具
taichunmin
0
410
簡單打造吸睛的圖+文傳單 | LINE電子傳單
taichunmin
0
250
LINE 數位版名片介紹
taichunmin
0
1.1k
能使用變數的訊息推送小工具 @ chatbot.tw 台中 2019/12
taichunmin
0
97
SERVEO 讓你用 Docker 開發 chatbot 也能過的去 @ COSCUP 2019
taichunmin
0
270
你應該要把沒用的 commit 壓扁 @ 微程式 2019/05/23
taichunmin
0
120
大學程式能力檢定 (CPE) 2017/03/28 成果報告 中山大學資訊工程系 楊昌彪 教授
taichunmin
0
180
Other Decks in Programming
See All in Programming
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
300
新卒PdEのリアル
ryu1013
1
480
Foundry Localでエージェント開発
seosoft
0
170
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
490
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
160
アクセシビリティから考える情報設計
high_g_engineer
0
350
Webの地図
yosuke_furukawa
PRO
6
4k
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
110
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
320
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
Family mrubyの進捗
kishima
1
110
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5.2k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
30 Presentation Tips
portentint
PRO
1
390
The Curse of the Amulet
leimatthew05
2
14k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Accessibility Awareness
sabderemane
1
210
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
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