跳到内容

GDPR Visitor Consent

v1.1.4

noraconley · 2018年6月19日 上架

Allow users to have control of what scripts are loaded.

正在使用
10+
评分
暂无
累计下载
1,926
最近更新
2022年1月15日
需要 WordPress 3.9+已测试到 5.8.20PHP 5.6+

截图

The front-end screen a user sees to configure their preferences.
The front-end screen a user sees to configure their preferences.
The user preferences as a shortcode, embedded into a page.
The user preferences as a shortcode, embedded into a page.
The admin script editing interface.
The admin script editing interface.
The admin script editing interface.
The admin script editing interface.

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 <script> and <img> tags. This will automatically place your JavaScript in a conditional and remove src attributes until a user has consented.

Example (PHP):

add_action( 'wp_head', 'your_wp_head' );

function your_wp_head() {
    // Check for GDPR Visitor Consent Plugin
    if ( function_exists( 'gdprvc_parse_script' ) ) {
        echo gdprvc_parse_script( 'your script as a string', 'slug' );
        return;
    }
    // Echo normally if plugin is not active
    echo 'your script as a string';
}

Browser Compatibility

Chrome
✓ Admin Editing
✓ Front-end functionality
✓ Front-end styles

Firefox
✓ Admin Editing
✓ Front-end functionality
✓ Front-end styles

Safari
✓ Admin Editing
✓ Front-end functionality
✓ Front-end styles

Edge
✓ Admin Editing
✓ Front-end functionality
✓ Front-end styles

IE11
✘ Admin Editing
✓ Front-end functionality
✓ Front-end styles

IE10
✘ Admin Editing
✓ Front-end functionality
✘ Front-end styles

IE9
✘ Admin Editing
✓ Front-end functionality
✘ Front-end styles

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums