Skip to content

Commit 9dfd310

Browse files
committed
Improve documentation
1 parent 40f04bf commit 9dfd310

File tree

2 files changed

+21116
-2
lines changed

2 files changed

+21116
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
WordPress Plugin providing a "accept" banner before embedding Google Analytics (and other scripts that can be registered)
44

5+
## Settings
6+
7+
This plugin has a setting page under "Tools".
8+
There, you can set some common Analytics codes, and disable the banner altogether if you only use
9+
the Gutenberg part of it.
10+
511
## API
612

713
### PHP
814

9-
You can use, for example,
15+
You can use, for example,
1016

1117
```php
1218
if (function_exists('wpca_enqueue_script')){
@@ -24,5 +30,25 @@ Do this wherever (i.e., in a init hook) you would do the `wp_enqueue_script`.
2430
This plugin exposes the following global functions:
2531

2632
```javascript
27-
33+
wpcaCookiesAreAllowed(); // returns whether all cookies are allowed
34+
wpcaAcceptCookies(); // trigger "accept all cookies"
35+
wpcaContentTypeIsAllowed(contentType); // returns whether the given content type is allowed
36+
wpcaAcceptContentType(contentType); // trigger "accept the given content type"
2837
```
38+
39+
Additionally, the event `wpcaCookiesAccepted` is triggered when all cookies are accepted,
40+
and `wpcaContentTypeAccepted` is triggered if a certain subset of cookies for one content type is accepted.
41+
42+
### Gutenberg
43+
44+
This plugin provides a Gutenberg block, called "External Content Wrapper",
45+
which blocks the child blocks from being rendered until sufficient cookie permissions are given.
46+
47+
#### Usage Example
48+
49+
1. Add the "External Content Wrapper" block to your post/page
50+
2. Select the content type (Analytics, Marketing, Social Media, etc.)
51+
3. Add your content blocks inside the wrapper
52+
4. The content will only be displayed after the user accepts the corresponding cookie type
53+
54+
This is particularly useful for embedding content from external sources like YouTube videos, Google Maps, or social media feeds that may track user data.

0 commit comments

Comments
 (0)