Chrome 第 92 版將變更 Conversion Measurement API。
異動內容
遵循 API 提案的變更 前幾個月,Chrome 的 API 實作方式也持續演進。異動內容如下:
- API 名稱和權限政策名稱。
- HTML 屬性名稱和
.well-known
網址。 - 報表的格式。要求主體中現在會以 JSON 格式傳送報表。
- 報告內容:
credit
與原本可能為 0 的報表一併移除。
在 Chrome 第 92 版中,維持不變的部分是系統支援的一組功能:事件層級報表,僅適用於點擊。 請務必掌握最新消息。這項異動生效後,我們會在日後的 Chrome 版本中推出其他更新和功能。
這些異動何時生效?
這些變更將從 Chrome 開始生效 92,穩定版,2021 年 7 月 20 日。 Chrome 92 Beta 版已於 2021 年 6 月 3 日發布。
此時該如何處理這種狀況?
如果您正在執行來源試用,或已導入這個 API 的示範資源, 選項:
- 方法 1 (建議):立即遷移程式碼,或在未來幾週 (建議在) 之前遷移程式碼 2021 年 7 月中旬。這樣一來,程式碼集就能用於日後的變更, 繼續為 Chrome 較新的用戶端提供支援
- 方法 2:等待日後的 Chrome 版本推出更多更新和功能。 然後一次進行所有必要的程式碼變更
遷移
遷移範例
您可以在這個提取要求 (草稿) 中查看小型試用版應用程式的遷移範例。
更新權限政策程式碼
舊版程式碼 | 新驗證碼 |
---|---|
allow='conversion-measurement' |
allow='attribution-reporting' |
更新功能偵測程式碼
舊版程式碼 | 新驗證碼 |
---|---|
document.featurePolicy.features() |
document.featurePolicy.features() |
更新 HTML 屬性
舊版程式碼 | 新驗證碼 |
---|---|
conversiondestination |
attributiondestination |
impressiondata |
attributionsourceeventid |
impressionexpiry |
attributionexpiry |
reportingorigin |
attributionreportto |
更新 window.open()
引數
您可以將歸因來源登錄至 window.open()
啟動的導覽。
如果您使用 window.open()
登錄歸因來源,請更新這些呼叫。
新程式碼看起來應該會像這樣 (重新命名後,將遵循 HTML 屬性中的 <名稱>):
window.open(
'https://dest.example',
'_blank',
'attributionsourceeventid=1234,attributiondestination=https://dest.example,attributionreportto=https://reporter.example,attributionexpiry=604800000'
);
更新註冊呼叫網址和參數
舊版程式碼 | 新驗證碼 |
---|---|
.well-known/register-conversion?conversion-data={DATA} |
.well-known/attribution-reporting/trigger-attribution?trigger-data={DATA} |
更新報表端點程式碼
舊版程式碼 | 新驗證碼 | |
---|---|---|
瀏覽器預期發出的要求 | .well-known/register-conversion?impression-data=&conversion-data={DATA}&attribution-credit=100 |
.well-known/attribution-reporting/trigger-attribution |
傳入的報表 | 傳送為網址參數。 | 在要求主體中以 JSON 格式傳送。 報表資料會以 JSON 物件的形式包含在請求主體中, 下列索引鍵: source_event_id :先前 impression-data ,在歸因來源中設定的 64 位元事件 ID。trigger_data :先前為 conversion-data ,歸因觸發條件中的 3 位元資料集
重新導向。⚠️ credit 已移除。
|
Attribution Reporting:所有資源
請參閱「歸因報表」一文。