You are here

public function ResponseSubscriber::onKernelResponse in Analytics 8

Respond to the kernel response event.

Parameters

\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event.

File

src/EventSubscriber/ResponseSubscriber.php, line 47

Class

ResponseSubscriber
Analytics ResponseSubscriber.

Namespace

Drupal\analytics\EventSubscriber

Code

public function onKernelResponse(FilterResponseEvent $event) {
  if (!$event
    ->isMasterRequest()) {
    return;
  }

  // Adds "Permissions-Policy: interest-cohort=()" header to disable FLoC.
  if ($this->config
    ->get('privacy.disable_floc')) {
    $event
      ->getResponse()->headers
      ->set('Permissions-Policy', 'interest-cohort=()');
  }
}