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

This is an old revision of the document!


Cookie Consent

:!: Available starting with VuFind 9.0.

The cookie consent prompt and settings allow the user to be informed about cookies used by the service and manage consent for non-essential cookies.

Sample Configurations

VuFind comes with cookie consent category configuration for the built-in cookies and Matomo. The following sample configurations can be added to CookieConsent.yaml (typically in local/config/vufind directory) for additional services. The samples only include the relevant parts for the service, so merge them with the full configuration as required.

Since these are third-party services, you will need to verify that the sample configurations are up to date and suitable for the region.

Note that the sample configuration have all the texts in English. The texts can be replaced with translation strings for multi-language support.

YouTube

:!: 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):

<html> <div class=“iframemanager” data-service=“youtube” data-id=“5q70TokaSrw”></div> </html>

CookieConsent.yaml:

CookieConsent:
  Categories:
    video:
      Title: Cookies for embedded video
      Description: Cookies set by video platforms when you view embedded media.
      DefaultEnabled: false
      Essential: false
      ControlIframeServices:
        - youtube
      Cookies:
        - Name: yt-player-bandwidth
          Domain: youtube.com
          ThirdParty: true
          Description: Used to estimate bandwidth.
          Expiration: session
        - Name: yt-player-headers-readable
          Domain: youtube.com
          ThirdParty: true
          Description: Used to store user's preferences.
          Expiration: session
        - Name: GPS
          Domain: youtube.com
          ThirdParty: true
          Description: Used to store user's location.
          Expiration: session
        - Name: VISITOR_INFO1_LIVE
          Domain: youtube.com
          ThirdParty: true
          Description: Used to estimate bandwidth.
          Expiration: 6
          ExpirationUnit: months
        - Name: PREF, __Secure-YEC
          Domain: youtube.com
          ThirdParty: true
          Description: Used to store user's preferences.
          Expiration: 8
          ExpirationUnit: months
        - Name: YSC, CONSENT, SOCS
          Domain: youtube.com
          ThirdParty: true
          Description: Used to track user's actions for marketing purposes.
          Expiration: 8
          ExpirationUnit: months
      AutoClearCookies:
        - 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
configuration/cookie_consent.1662535608.txt.gz · Last modified: 2022/09/07 07:26 by emaijala