Cookie life time analysis
---
## Background
### Safari
#### ITP 介紹
#### Privacy Preserving Ad Click Attribution For the Web
* Announced Date : 2019/05/22
* 原則
* 用戶不得因為點擊廣告而被跨站辨識身份
* 只有用戶親自造訪的網站才可以取得廣告點擊和轉換資料
* 瀏覽器在通報廣告點擊的過程,應代替用戶、儘力確保用戶隱私
* 隱私考量政策
* 只有在第一方網頁上投放的鏈接才能存儲廣告點擊的數據。這可確保用戶有機會了解隱私保護廣告點擊歸因的工作原理。
* 廣告點擊發生的網站和發生轉化的網站(廣告主)都不應該能夠查看廣告點擊數據是否已存儲,已匹配(matched)或已安排報告。
* 廣告點擊只應存儲一段有限的時間,例如一周。用戶今天所做的購買不應歸因於他們幾個月前的廣告點擊。
* 廣告主只能紀錄最多64個不同的campaign ID和Conversion data,因此無法重新利用此數據以進行用戶跨站追蹤。
* 廣告點擊資料request應在24至48小時內隨機延遲。這可確保在廣告點擊後短時間內發生的conversion不能被用來跨站分析。
* 為了避免對用戶的跨站追蹤,瀏覽器不應保證任何廣告點擊資料請求的順序。
* 瀏覽器應使私人或隱身模式(ephemeral session),來製作廣告點擊資料。
* 瀏覽器不應取得或使用任何身份憑據,例如Cookie, client certificates,或廣告點擊request/resoense中的Basic Authentication
* 瀏覽器應該提供一種打開和關閉廣告點擊資訊的方法。我們打算將default設置此政策,鼓勵網站捨棄一般的跨站追蹤。
* 瀏覽器不應在私人/隱身模式下蒐集用戶的廣告點擊資料。
* ref :
* https://webkit.org/blog/8943/privacy-preserving-ad-click-attribution-for-the-web/
* https://www.ithome.com.tw/news/130844
#### Intelligent Tracking Prevention
* Announced Date : 2017/06/05
* 情境:
1. ITP將example.com標示為有能力跨站追蹤用戶的domain
2. 若用戶超過30天沒有訪問 example.com,其資料和cookie會被消滅
3. 其他狀況下,cookie會依照下圖的時間線改變權限
* note: 如果在一~三十天的時間造訪,會得到partition過後的cookie,以確保用戶的登入,同時避免跨站追蹤
* 結論:
* 用戶的cookie和資料只會在持續互動的網站上是永久的
* 追蹤資料會在瀏覽網站時被主動移除
* ref:
* https://webkit.org/blog/7675/intelligent-tracking-prevention/
#### Intelligent Tracking Prevention 2.0
* Announced Date : 2018/06/04
* 只有partitioned cookie被紀錄,用來被特定的API取用資訊
* 情境
* ref:
* https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/
#### Intelligent Tracking Prevention 2.2
* Released Version: iOS 12.3 and Safari on macOS Mojave 10.14.5
* Released Date:
* iOS 12.3 : 2019/5/14
* macOS Mojave 10.14.5 : 2019/5/14
* 主旨:當滿足下列兩條件時,(目前網站)cookie只會有一天的壽命
* 一個(被分類為有能力)跨站追蹤的domain負責導引用戶到目前的網站時
* 導引到的url最後包含了query string 或fragment identifier(Link Decoration)

* 情境:
1. The website social.example has been classified by ITP as having cross-site tracking capabilities.
2. The user clicks a link on social.example.
3. The click results in a cross-site navigation that lands on shop.example and the landing URL has a query string and/or a fragment identifier.
4. The shop.example webpage sets a persistent cookie through document.cookie. This cookie will now have a maximum expiry of one day.
* ref:
* https://webkit.org/blog/8828/intelligent-tracking-prevention-2-2/
### Google(still planing on May)
* enable users to clear all such cookies while leaving single domain cookies unaffected
* protecting cookies from cross-site injection and data disclosure attacks like Spectre and CSRF by default
* developers need to explicitly specify which cookies are allowed to work across websites
#### 反ITP流程
* google在用戶點擊廣告時在url最後加上一段unique的GCLID(每一次的點擊都會產生新的)讓第三方紀錄
* 廣告主也將每天蒐集到的GCLID給第三方追蹤
Q:google給的cookieID和宇匯的cookieID是否一致?
* https://zhuanlan.zhihu.com/p/30515285