https://github.com/bernhardwebstudio/wp-conditional-analytics
WordPress Plugin providing a "accept" banner before embedding Google Analytics
https://github.com/bernhardwebstudio/wp-conditional-analytics
Last synced: 7 months ago
JSON representation
WordPress Plugin providing a "accept" banner before embedding Google Analytics
- Host: GitHub
- URL: https://github.com/bernhardwebstudio/wp-conditional-analytics
- Owner: BernhardWebstudio
- License: mit
- Created: 2023-08-27T06:28:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T18:36:25.000Z (over 2 years ago)
- Last Synced: 2024-12-28T09:43:14.293Z (over 1 year ago)
- Language: PHP
- Size: 290 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wp-conditional-analytics
WordPress Plugin providing a "accept" banner before embedding Google Analytics (and other scripts that can be registered)
## API
### PHP
You can use, for example,
```php
if (function_exists('wpca_enqueue_script')){
wpca_enqueue_script($id, $url);
} else {
wp_enqueue_script($id, $url);
}
```
to enqueue a script that should be loaded in case the cookies are accepted.
Do this wherever (i.e., in a init hook) you would do the `wp_enqueue_script`.
### JavaScript
This plugin exposes the following global functions:
```javascript
```