Unrealistic integration
-
It is unrealistic to think website owners will be able to update all the various script tags that WP Core, Themes and Plugins add to our sites.
It is equally unrealistic to think that WordPress Core developers and all Theme and Plugins developers will adjust their code base for a single product (Cookiebot).
This plugin should, and can, do all of that work, fairly easily:
1) Add an admin page that asks for my Cookiebot Domain Group ID and stores it in the site database.
2) Once submitted, you can now connect the dots between the site I registered at cookiebot.com, which you have already scanned, and the site I am adding this plugin to.
3) Once you have that, you can use WP’s built-in
wp_enqueue_script
function to add your script to the site’s pages, like:
wp_enqueue_script( 'cookiebot_script', '//consent.cookiebot.com/uc.js' );
4) Then you can use WP’s built-in
script_loader_tag
filter to add theasync
anddata-cbid
attributes, like:
add_filter( 'script_loader_tag', 'add_async_and_data_attribute', 10, 2 );
... str_replace( ' src', ' data-cbid="'.plugin_options[cookiebot_id].'" async="async" src', $tag ) ...
5) And if you really want to impress, you could use your extensive cookie script database, along with the above
script_loader_tag
, to also add the properdata-cookieconsent
attribute to each known script tag.This should take a single developer a couple days, or a small team the better part of a day, to knock out.
This would also make Cookiebot leap to the front of their competitors for any WP site owner.
Think about it.
Thanks,
AtgThe page I need help with: [log in to see the link]
- The topic ‘Unrealistic integration’ is closed to new replies.