Skip to content
Snippets Groups Projects

Resolve "cookie banner for matomo"

Merged Piotr Gawron requested to merge 301-cookie-banner-for-matomo into development
4 files
+ 43
17
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -5,10 +5,14 @@ import { useAppSelector } from '@/redux/hooks/useAppSelector';
import { Button } from '@/shared/Button';
import Link from 'next/link';
import React, { useEffect, useState } from 'react';
import { cookiePolicyUrlSelector } from '@/redux/configuration/configuration.selectors';
import {
cookiePolicyUrlSelector,
matomoUrlSelector,
} from '@/redux/configuration/configuration.selectors';
import { OptionInput } from '@/components/Map/Drawer/ExportDrawer/CheckboxFilter/OptionInput';
import { CheckboxItem } from '@/components/Map/Drawer/ExportDrawer/CheckboxFilter/CheckboxFilter.types';
import { ZERO } from '@/constants/common';
import { injectMatomoTracking } from '@/utils/injectMatomoTracking';
import {
USER_ACCEPTED_COOKIES_COOKIE_NAME,
USER_ACCEPTED_COOKIES_COOKIE_VALUE,
@@ -24,6 +28,7 @@ export const CookieBanner = (): React.ReactNode => {
const dispatch = useAppDispatch();
const { visible, accepted } = useAppSelector(selectCookieBanner);
const cookiePolicyUrl = useAppSelector(cookiePolicyUrlSelector);
const matomoUrl = useAppSelector(matomoUrlSelector);
const [options, setOptions] = useState([selectMatomoOption]);
@@ -51,6 +56,7 @@ export const CookieBanner = (): React.ReactNode => {
USER_ACCEPTED_MATOMO_COOKIES_COOKIE_NAME,
USER_ACCEPTED_COOKIES_COOKIE_VALUE.ACCEPTED,
);
injectMatomoTracking(matomoUrl);
} else {
localStorage.setItem(
USER_ACCEPTED_MATOMO_COOKIES_COOKIE_NAME,
Loading