See: https://support.cookiebot.com/hc/en-us/articles/360003790854-Iframe-cook...

The auto mode also blocks iframes (which is helpful, see #3088055: Implement iframe blocking in manual mode). When using common modules like youtube_embed or others, site admins don't have many options to add a code like this on videos. I guess it would be very helpful to add a dependent option to show this message (perhaps via JS) with a customizable message if auto-blocking mode is enabled.

<div class="cookieconsent-optout-marketing">
Please <a href="javascript:Cookiebot.renew()">accept marketing-cookies</a> to watch this video.
</div>

Should apply to Drupal 8 and 7.

Comments

Anybody created an issue. See original summary.

anybody’s picture

Issue summary: View changes
anybody’s picture

I'll start with the development of this feature soon.

anybody’s picture

Patch attached, please review! This patch is based on #3098778: Add schema (& translatability) #3 so that patch cookiebot_add_schema-3098778-3.patch has to be applied before!

anybody’s picture

anybody’s picture

Status: Active » Needs review
anybody’s picture

Title: Add optional message for iframes if auto-mode is enabled » Add placeholder message for blocked iframes
anybody’s picture

StatusFileSize
new53.21 KB

This is what the form looks like:

Cookiebot iframe placeholder message form

anybody’s picture

TODOs:

  • Message is added multiple times if the consent banner is closed without consent
  • See markup below checkox
  • Remove "?" from checkbox label
a.milkovsky’s picture

Status: Needs review » Needs work
+++ b/cookiebot.module
@@ -115,6 +116,10 @@ function cookiebot_page_attachments_alter(array &$page) {
+    'message_iframe_cookieconsent_optout_marketing' => str_replace(["\r", "\n"], '', Xss::filterAdmin($config->get('message_iframe_cookieconsent_optout_marketing'))),

Let's create a template instead of saving HTML in the database. The "Please accept marketing cookies" text can be stored in the config.

anybody’s picture

Thank you @a.milkovsky for your feedback! Yes that's a good idea. I'd suggest to put this into the database, otherwise it would be much less flexible because of the splitting, do you agree?

Please <a href="!cookiebot_renew" class="cookieconsent-optout-marketing__cookiebot-renew">accept marketing-cookies</a> to view this embedded content from <a href="!cookiebot_from_src_url" target="_blank" class="cookieconsent-optout-marketing__from-src-url">!cookiebot_from_src_url</a>

Attached is a new patch which fixed the points from #9 and wraps and explains the form elements a bit better.

I'll add a new patch after your reply containing the template.

anybody’s picture

Title: Add placeholder message for blocked iframes » Add placeholder message for blocked data-src elements (iframe, ...)
StatusFileSize
new11.76 KB

Completely new patch attached based on #5 from #3098778: Add schema (& translatability) (can we please get that done do proceed in other issues first?).
I now implemented your suggestions from #10.

Please review.

anybody’s picture

Status: Needs work » Needs review
anybody’s picture

StatusFileSize
new13.87 KB

I decided to add a complete patch now, which includes Patch from #3098778: Add schema (& translatability)-#5 now and will be easier to test.

It also contains a further change of

if (!$config->get('cookiebot_show_declaration') || empty($cbid)) {

from #14 which is required due to the change to boolean. Before the code was strictly compared to !== 1 which fails with a boolean schema.

arnested’s picture

Is there any reason this only handles the marketing category?

arnested’s picture

Also the latest patch removes the async attribute again :)

anybody’s picture

Hi @arnested,

thank you for your feedback!

#15 will of course be resolved with a final patch. It was created while the other issue was in work. Sorry. Thank you for the hint.

#16:

Is there any reason this only handles the marketing category?

Yes, I also thought a lot about it. Looking into the cookiebot automatic code, the data-src automatism always sets this category. Blocked sources will 99,9% be Marketing, I can't imagine many cases where an iframe or video is "statistics" or "preferences".
We could also add a separate text for each type or remove the type completely / match all, but as of YAGNI I'd only add what is currently needed. It will be simple to add the same for other categories when needed.

arnested’s picture

That's fine, @Anybody.

I just made me wonder.

On our company website we have some iframes from our Vimeo account that we have put into "statistics". But that is with the manual mode. If auto-blocking mode always chooses marketing then I can see why going with that (for now) is fine.

anybody’s picture

Would you like to use that feature for statistics? (look at the JS code) or would you solve it differently anyway?

arnested’s picture

We only use the manual mode and we have added the fallback/placeholder stuff to our templates ourselves. I think we'll prefer to keep control this way despite being a bit more work. So I think keeping it marketing only is a reasonable choice given it will be sufficient for auto-blocking mode.

a.milkovsky’s picture

Thank you @a.milkovsky for your feedback! Yes that's a good idea. I'd suggest to put this into the database, otherwise it would be much less flexible because of the splitting, do you agree?

Looks good. What about puting entire message with HTML into a template? The same way as in eu_cookie_compliance.

anybody’s picture

Well I think that's a huge disadvantage for users and from my perspective content doesn't belong into template. It would require every page owner / admin to know about theming to change the texts and placeholders.
The text and the placeholders are definitely config, I think and I would suggest to leave this as it is as a good compromise. Anyway, it's just my opinition and I think there is no "real truth" :)

anybody’s picture

Any more feedback? Can we set this RTBC and commit to dev?

anybody’s picture

Note to myself: Before commit I have to recheck, why these lines were removed and if it was intended or by mistake:

-  else {
-    $cookiebot['#attributes']['async'] = 'async';
-  }
anybody’s picture

Title: Add placeholder message for blocked data-src elements (iframe, ...) » Add translatability & placeholder message for blocked data-src elements (iframe, ...)

Final patch now with correction from #24 and basic CSS for the placeholder message.
Please review and test. This now includes #3098778: Add schema (& translatability) which is also essential for the message to be translatable. This way it will be easier to ship.

anybody’s picture

anybody’s picture

Not my day, I selected the wrong patch, sorry. Now here we go.

The last submitted patch, 26: cookiebot_add-element-placeholder-message-COMPLETE-INCLUDING-3098778-5_3093976-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 27: cookiebot_add-element-placeholder-message-COMPLETE-INCLUDING-3098778-5_3093976-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anybody’s picture

Status: Needs work » Needs review
StatusFileSize
new16.59 KB

Codesniffer fixes.

Status: Needs review » Needs work

The last submitted patch, 30: cookiebot_add-element-placeholder-message-COMPLETE-INCLUDING-3098778-5_3093976-30.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anybody’s picture

Title: Add translatability & placeholder message for blocked data-src elements (iframe, ...) » Add translatability & placeholder message for blocked data-src elements (iframe, ...) [D8 + D7]
Status: Needs work » Needs review
StatusFileSize
new15.4 KB
new12.55 KB

D8 Codestyle fixes and Drupal 7 backport attached.

anybody’s picture

The last submitted patch, 32: 8.x-1.x-cookiebot_add-element-placeholder-message-COMPLETE-INCLUDING-3098778-5_3093976-32.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anybody’s picture

D7 version is failing, because it is based on #3100878: Backport important functionality to Drupal 7 which should be committed first. Afterwards we should proceed with the backport here.

Status: Needs review » Needs work
anybody’s picture

I committed #3100878: Backport important functionality to Drupal 7 to 7.x-1.x so we can now proceed with these improvements / backports to 7.x!

anybody’s picture

Ok the Drupal 7 version is also ready. The remaining 4 codesniffer entries are OK and intended, because it's a reset for inline styles set. Ready for RTBC! :)

thomas.frobieter’s picture

Status: Needs review » Reviewed & tested by the community

  • Anybody committed cfd6cc2 on 7.x-1.x
    Issue #3093976 by Anybody,a.milkovsky,arnested: Add translatability...

  • Anybody committed 9cd0f09 on 8.x-1.x
    Issue #3093976 by Anybody,a.milkovsky,arnested: Add translatability...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Committed to dev in 7.x and 8.x - thank you all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.