
內容簡介
允許使用者控制載入哪些腳本。
腳本以群組方式(必需、行銷、分析等)分類。 您也可以鎖定一個群組,以使使用者無法停用該群組中的腳本(像 WordPress 或 Stripe Cookies 一樣)。
我們強烈建議您對您的網站進行審核,以查找可能正在追踪使用者的腳本。 追踪使用者的腳本可能包括:分析腳本、CRM腳本、追踪像素等。
使用簡碼[gdpr_visitor_consent]創建用戶偏好頁面。 使用此簡碼,使用者可以在以後更改其 GDPR 喜好設定。
開發者 API
您可以使用篩選器gdprvc_third_party_script( $scripts );在管理螢幕中的下拉選單中添加您的腳本。
範例(PHP):
function add_third_party_script( $scripts ) {
$scripts[] = array(
'slug' => 'third-party-script',
'label' => 'Script Label',
);
return $scripts;
}
add_filter( 'gdprvc_third_party_scripts', 'add_third_party_script', 10, 1 );
然後,您可以在瀏覽器中使用 JavaScript API 來控制前端的腳本:
範例(JavaScript):
window.gdprvc_is_accepted( 'slug' );
// 返回true/false
您還可以使用我們的輔助函數來解析包含<script>和<img>標記的腳本。 這將自動將您的JavaScript放置在條件語句中,並在使用者同意之前刪除src屬性。
範例(PHP):
add_action( 'wp_head', 'your_wp_head' );
function your_wp_head() {
// 檢查 GDPR Visitor Consent Plugin
if ( function_exists( 'gdprvc_parse_script' ) ) {
echo gdprvc_parse_script( 'your script as a string', 'slug' );
return;
}
// 未啟用插件時正常回傳
echo 'your script as a string';
}
瀏覽器相容性
Chrome
✓ 管理員編輯
✓ 前端功能
✓ 前端樣式
Firefox
✓ 管理員編輯
✓ 前端功能
✓ 前端樣式
Safari
✓ 管理員編輯
✓ 前端功能
✓ 前端樣式
Edge
✓ 管理員編輯
✓ 前端功能
✓ 前端樣式
IE11
✘ 管理員編輯
✓ 前端功能
✓ 前端樣式
IE10
✘ 管理員編輯
✓ 前端功能
✘ 前端樣式
IE9
✘ 管理員編輯
✓ 前端功能
✘ 前端樣式
外掛標籤
開發者團隊
原文外掛簡介
Allow users to have control of what scripts are loaded.
Scripts are grouped together (Required, Marketing, Analytics, etc). You can also lock a group, so that a user cannot disable a script within that group (think WordPress or Stripe cookies).
We strongly encourage you to perform an audit of you site to find out what scripts may be tracking users. Scripts that track users could include such things as: analytics scripts, CRM scripts, tracking pixels, and more.
Use the shortcode [gdpr_visitor_consent] to create a user preferences page. Using this shortcode, a user can change their GDPR preferences at a later date.
Developer API
You can add your script in a dropdown in the admin screen using the filter gdprvc_third_party_script( $scripts );
Example (PHP):
function add_third_party_script( $scripts ) {
$scripts[] = array(
'slug' => 'third-party-script',
'label' => 'Script Label',
);
return $scripts;
}
add_filter( 'gdprvc_third_party_scripts', 'add_third_party_script', 10, 1 );
You can then use the JavaScript API in the browser to control your scripts on the front-end
Example (JavaScript):
window.gdprvc_is_accepted( 'slug' );
// returns true/false
You can also use our helper function to parse your script containing
