About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
configuration:cookie_consent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
configuration:cookie_consent [2022/09/07 15:41] emaijalaconfiguration:cookie_consent [2022/09/30 09:26] (current) – [JavaScript Events] emaijala
Line 11: Line 11:
 Cookie categories and further configuration is in CookieConsent.yaml. See the comments in the file and the sample configurations below for further information. Cookie categories and further configuration is in CookieConsent.yaml. See the comments in the file and the sample configurations below for further information.
  
-Note that if enabled categories or cookies in the categories are changed, the consentRevision setting in config.ini should be incremented. This makes VuFind re-request consent. There is also ''popup_revision_message_html'' translation string that allows you to add a message for those that have previously consented but are now prompted again because of the new revision.+Note that if enabled categories or cookies in the categories are changed, the **consentRevision setting in config.ini must be incremented**. This makes VuFind re-request consent and ensures that invalid categories do not remain in the consent cookie. There is also ''popup_revision_message_html'' translation string that allows you to add a message for those that have previously consented but are now prompted again because of the new revision.
  
 +Default translation texts include a link to the [[configuration:user_privacy#privacy_policy|Privacy Policy]] page that also displays the current cookie consent. Please ensure that the page contains correct information.
 + 
 ===== Language Translations ===== ===== Language Translations =====
  
Line 44: Line 46:
  
 ^ Event                       ^ Description                                    ^ ^ Event                       ^ Description                                    ^
-| cookie-consent-done         | User has clicked on any of the consent buttons +vf-cookie-consent-first-done   | User has given first consent                   | 
-| cookie-consent-change       | User has changed their consent                 | +| vf-cookie-consent-done         | User has given consent or the page has been loaded with a stored consent | 
-| cookie-consent-initialized  | Cookie consent service has been initialized    |+vf-cookie-consent-changed      | User has changed their consent                 | 
 +vf-cookie-consent-initialized  | Cookie consent service has been initialized    |
  
 ===== Sample Configurations ===== ===== Sample Configurations =====
Line 60: Line 63:
 :!: At least expiration times may differ depending on region. :!: At least expiration times may differ depending on region.
  
-The following configuration including the IframeServices part allows you to display videos based on user consent. If the user has allowed the cookies for the category, videos are automatically displayed. If not, the user gets a prompt instead. For this to work, the video must be embedded on the page like this (data-id is the identifier of the video in YouTube): +The following template and configuration allow you to display videos based on user consent. If the user has allowed the cookies for the category, videos are displayed. If not, the user gets a message and a link instead.
- +
-<html> +
-<div class="iframemanager" data-service="youtube" data-id="5q70TokaSrw"></div> +
-</html> +
- +
-You can also check if iframe manager is active:+
  
 +Template example:
 <code php> <code php>
-  <?php if ($this->plugin('cookieConsent')->isIframeManagerActive()): ?> +<?php $cookieConsent = $this->plugin('cookieConsent')?> 
-    <div style="width: 560px; height: 315px" class="iframemanager" data-service="youtube" data-id="5q70TokaSrw"></div> +<?php if (!$cookieConsent->isEnabled() || $cookieConsent->isCategoryAccepted('video')): ?> 
-  <?php else: ?> +  <iframe width="560" height="315" src="https://www.youtube.com/embed/5q70TokaSrw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe
-    <iframe width="560" height="315" src="https://www.youtube.com/embed/5q70TokaSrw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> +<?php else: ?
-  <?php endif; ?>+  <div class="alert alert-warning"> 
 +    <p> 
 +      The video cannot be displayed due to missing cookie consent. 
 +      Check <a href="#" type="button" data-cc="show-preferencesModal" aria-haspopup="dialog">Cookie Settings</a> to make changes. 
 +    </p> 
 +    <p> 
 +      You can also view the video on <a href="https://www.youtube.com/watch?v=5q70TokaSrw" target="_blank">YouTube</a> (external link). 
 +    </p> 
 +  </div> 
 +<?php endif; ?>
 </code> </code>
  
Line 85: Line 92:
       DefaultEnabled: false       DefaultEnabled: false
       Essential: false       Essential: false
-      ControlIframeServices: 
-        - youtube 
       Cookies:       Cookies:
         - Name: yt-player-bandwidth         - Name: yt-player-bandwidth
Line 123: Line 128:
       AutoClearCookies:       AutoClearCookies:
         - Name: '/^(yt-player-.*|GPS|VISITOR_INFO1_LIVE|PREF|__Secure-YEC|YSC|CONSENT|SOCS)$/'         - Name: '/^(yt-player-.*|GPS|VISITOR_INFO1_LIVE|PREF|__Secure-YEC|YSC|CONSENT|SOCS)$/'
-  IframeServices: 
-    youtube: 
-      EmbedUrl: 'https://www.youtube.com/embed/{data-id}' 
-      #ThumbnailUrl: 'https://i3.ytimg.com/vi/{data-id}/hqdefault.jpg' 
-      IframeAllow: accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen 
-      Description: This content is loaded from https://www.youtube.com. Your consent to store cookies placed by YouTube is required to view the content. 
-      AllowOnceText: Show video 
-      AllowAlwaysText: Show video and always allow embedded YouTube content 
-</code> 
- 
-==== Iframe Manager ==== 
- 
-If you use iframe manager (like in the YouTube video example above), add this to the ''essential'' category: 
- 
-<code yaml> 
-        - Name: 'cc_*' 
-          Domain: '{{vufind_cookie_domain}}' 
-          Description: CookieConsent::cookie_description_consent_html 
-          Expiration: '{{consent_cookie_expiration}}' 
-          ExpirationUnit: days 
 </code> </code>
  
 ---- struct data ---- ---- struct data ----
-properties.Page Owner : +properties.Page Owner : emaijala
 ---- ----
  
configuration/cookie_consent.1662565276.txt.gz · Last modified: 2022/09/07 15:41 by emaijala