[WordPress] 外掛分享: ITP Cookie Saver – Convert javascript cookies to server cookies

首頁外掛目錄 › ITP Cookie Saver – Convert javascript cookies to server cookies
20+
安裝啟用
尚無評分
1138 天前
最後更新
問題解決
WordPress 4.0+ PHP 5.3+ v1.2.1 上架:2019-06-15

內容簡介

這個外掛可以消除某些瀏覽器對cookie的七天期限限制。許多瀏覽器開始限制由Javascript設置的cookie的生存週期,例如Safari ITP 2.1。

為什麼對生存週期的限制會成為問題?

根據你的網站,可能會有許多問題。兩個主要的問題可能是:
1. 追踪
2. Cookie同意橫幅

追踪
大多數追踪工具,例如Google Analytics,都是通過Javascript設置其cookie。如果cookie在七天之後被刪除,這些工具就不能再將用戶識別為回頭客,因此,缺席七天後,每個用戶都是一個新用戶。

Cookie同意橫幅
如果cookie同意橫幅實施是通過Javascript設置cookie,則這是一個問題。這是大多數橫幅的實施方式。
如果瀏覽器將cookie生存週期限制為七天,即使用戶已經做出選擇,用戶每七天也會看到橫幅。
這可能會讓用戶感到煩惱,並對轉換率產生影響。

這個外掛怎麼運作?

作為HTTP協議的一部分,所有cookie都會隨著每個請求一起發送到後端。
該外掛利用此事實,通過檢查每個請求是否存在其中一個已定義的cookie,來設置該cookie的值。如果存在已定義的cookie,則通過相同的值再次設置它。

現在,cookie是由服務器設置的,並繞過了Javascript cookie生存週期的限制。

使用這種方法的一個挑戰可能是,cookie是在頁面加載開始時設置的。在頁面加載期間,可能會有覆蓋cookie的Javascript。在這種情況下,Javascript cookie生存週期的限制再次生效。

可以通過檢查"before unload"功能來避免這種情況。啟用此功能後,每當用戶離開頁面時,都會在後台發送額外的請求,並重新設置cookie。
因此,您可以確信,服務器是最後一個接觸cookie的位置。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「ITP Cookie Saver – Convert javascript cookies to server cookies」→ 直接安裝(推薦)

原文外掛簡介

This plugin removes the seven days limitations of cookies in certain browsers. Many browsers start to limit the cookie lifetime of cookies which are set by javascript to a short period of time, e.g. Safaris ITP 2.1.
Why is the limitation of the lifetime a Problem?
Depending on your website their might be a lot of Problems. The two main challenges might be:
1. Tracking
2. Cookie Consent Banner
Tracking
Most Tracking Tools, like Google Analytics for example are setting their cookies by javascript. If the cookie is deleted after seven days, the tools are not able to recognize the user as a returning user anymore, so after seven days of absence every user is a new user.
Cookie Consent Banner
It is a problem, if the cookie consent banner implementation sets the cookie with javascript. This is how most of the banner implementation do it.
If the cookie lifetime is limited by the browser to seven days, the user will see the banner every seven days, even if he made already a choice.
This can be annoying and conversion relevant.
How does this Plugin work exactly?
As part of the HTTP protocol all cookies are always send to the backend with every request.
This plugin uses this fact, by checking every request if one of the defined cookies is present. If a defined cookie is present, it sets it with the same value again.
Now the cookie is set by the server and the javascript cookie lifetime limitation is bypassed.
A challenge with this approach might be, that the cookie is set at the beginning of a page load. During page load there might be javascripts, which overwrite the cookie. In that case the javascript cookie lifetime limitation is kicking in again.
This can be avoided by checking the “before unload”- feature. With this feature enabled, everytime the user leaves a page, an additional request is send in the background and the cookies are set again.
So you can be sure, the server was the last to touch the cookie.

文章
Filter
Apply Filters
Mastodon