PageSourceSearch

https://www.fredrikstad.kommune.no/scripts/cookieconsent-config.js

js fredrikstad.kommune.no collected 2026-10-02 03:08:35 UTC 14,177 bytes, 287 lines download raw bytes

1/**
2 * All config. options available here:
3 * https://cookieconsent.orestbida.com/reference/configuration-reference.html
4 */
5
6//import CookieConsent from "vanilla-cookieconsent";
7import * as CookieConsent from "/scripts/cookieconsent-3.0.1/dist/cookieconsent.esm.js";
8
9const CAT_NECESSARY = "necessary";
10const CAT_FUNCTIONALITY = "functionality";
11const CAT_ANALYTICS = "analytics";
12
13const SERVICE_ANALYTICS_STORAGE_GA = "analytics_storage_ga";
14const SERVICE_ANALYTICS_STORAGE_MS = "analytics_storage_ms";
15const SERVICE_FUNCTIONALITY_STORAGE_MYPAGE = "functionality_storage_mypage";
16const SERVICE_FUNCTIONALITY_STORAGE_FORMS = "functionality_storage_forms";
17const SERVICE_FUNCTIONALITY_STORAGE_KARI = "functionality_storage_kari";
18
19// Define datalayer and the gtag function
20window.dataLayer = window.dataLayer || [];
21function gtag(){dataLayer.push(arguments);}
22
23// Default consent set to 'denied'
24gtag('consent', 'default', {
25    [SERVICE_ANALYTICS_STORAGE_GA]: 'denied',
26    [SERVICE_ANALYTICS_STORAGE_MS]: 'denied',
27    [SERVICE_FUNCTIONALITY_STORAGE_MYPAGE]: 'denied',
28    [SERVICE_FUNCTIONALITY_STORAGE_FORMS]: 'denied',
29    [SERVICE_FUNCTIONALITY_STORAGE_KARI]: 'denied',
30});
31
32/**
33 * Update gtag consent according to the users choices make in CookieConsent UI
34 */
35function updateGtagConsent() {
36    gtag('consent', 'update', {
37        [SERVICE_ANALYTICS_STORAGE_GA]: CookieConsent.acceptedService(SERVICE_ANALYTICS_STORAGE_GA, CAT_ANALYTICS) ? 'granted' : 'denied',
38        [SERVICE_ANALYTICS_STORAGE_MS]: CookieConsent.acceptedService(SERVICE_ANALYTICS_STORAGE_MS, CAT_ANALYTICS) ? 'granted' : 'denied',
39        [SERVICE_FUNCTIONALITY_STORAGE_MYPAGE]: CookieConsent.acceptedService(SERVICE_FUNCTIONALITY_STORAGE_MYPAGE, CAT_FUNCTIONALITY) ? 'granted' : 'denied',
40        [SERVICE_FUNCTIONALITY_STORAGE_FORMS]: CookieConsent.acceptedService(SERVICE_FUNCTIONALITY_STORAGE_FORMS, CAT_FUNCTIONALITY) ? 'granted' : 'denied',
41        [SERVICE_FUNCTIONALITY_STORAGE_KARI]: CookieConsent.acceptedService(SERVICE_FUNCTIONALITY_STORAGE_KARI, CAT_FUNCTIONALITY) ? 'granted' : 'denied',
42    })
43}
44
45CookieConsent.run({
46
47    // Settings
48    autoShow: true,
49    disablePageInteraction: false,
50
51    onFirstConsent: ({cookie}) => {
52        console.log("onFirstConsent");
53        updateGtagConsent();
54    },
55    onConsent: ({cookie}) => {
56        console.log("onConsent");
57        updateGtagConsent();
58    },
59    onChange: ({cookie, changedCategories, changedServices}) => {
60        console.log("onChange");
61        updateGtagConsent();
62    },
63
64    cookie: {
65        name: 'CookieConsent',
66        domain: window.location.hostname,
67        path: '/',
68        secure: true,
69        expiresAfterDays: 90,
70        sameSite: 'Strict',
71        useLocalStorage: false
72    },
73
74    categories: {
75        [CAT_NECESSARY]: {
76            enabled: true,  // this category is enabled by default
77            readOnly: true  // this category cannot be disabled
78        },
79        [CAT_ANALYTICS]: {
80            autoClear: {
81                cookes: [
82                    {
83                        name: /^(_ga|_gid)/
84                    }
85                ]
86            },
87            services: {
88                [SERVICE_ANALYTICS_STORAGE_GA]: {
89                    label: 'Slår på lagring av cookies relatert til analyse med Google Analytics.',
90                },
91                [SERVICE_ANALYTICS_STORAGE_MS]: {
92                    label: 'Slår på lagring av cookies relatert til analyse med Microsoft Clarity.',
93                },
94            }
95        },
96        [CAT_FUNCTIONALITY]: {
97            services: {
98                [SERVICE_FUNCTIONALITY_STORAGE_MYPAGE]: {
99                    label: 'Slår på lagring av cookies relatert til Min Side.',
100                },
101                [SERVICE_FUNCTIONALITY_STORAGE_FORMS]: {
102                    label: 'Slår på lagring av cookies relatert til innsending av enkle skjemaer.',
103                },
104                [SERVICE_FUNCTIONALITY_STORAGE_KARI]: {
105                    label: 'Slår på lagring av cookies relatert til Kommune-Kari.',
106                },
107            }
108        }
109    },
110
111    guiOptions: {
112        consentModal: {
113            layout: 'bar inline',
114            position: 'middle center',
115            flipButtons: false,
116            equalWeightButtons: true
117        },
118        preferencesModal: {
119            layout: 'bar wide',
120            // position: 'left right',
121            flipButtons: false,
122            equalWeightButtons: true
123        }
124    },
125
126    language: {
127        default: 'no',
128        translations: {
129            no: {
130                consentModal: {
131                    title: 'Vi bruker informasjonskapsler (cookies)',
132                    description: 'Våre nettsider benytter informasjonskapsler (cookies) til sikkerhet, innbyggerfunksjonalitet, statistikk og analyse. Les om hvilke cookies vi bruker og hvordan vi administrerer de i erklæringen vår om Personvern og Informasjonskapsler.',
133                    acceptAllBtn: 'Aksepter alle',
134                    acceptNecessaryBtn: 'Kun nødvendige',
135                    showPreferencesBtn: 'Administrer cookie-innstillinger',
136                    footer: `
137                        <a href="/personvern/">Personvern og informasjonskapsler</a>
138                    `
139                },
140                preferencesModal: {
141                    title: 'Administrer cookies-innstillinger',
142                    acceptAllBtn: 'Aksepter alle',
143                    acceptNecessaryBtn: 'Kun nødvendige',
144                    savePreferencesBtn: 'Lagre mine valg',
145                    closeIconLabel: 'Lukk',
146                    serviceCounterLabel: 'Tjeneste(r)',
147                    sections: [
148                        {
149                            title: 'Informasjonskapsler (cookies)',
150                            description: 'Våre nettsider benytter informasjonskapsler (cookies) til sikkerhet, innbyggerfunksjonalitet, statistikk og analyse. Les om hvilke cookies vi bruker og hvordan vi administrerer de i erklæringen vår om Personvern og Informasjonskapsler.',
151                        },
152                        {
153                            title: 'Nødvendige cookies',
154                            description: 'Disse støtter opp under kjernefunksjonalitet knyttet til nettsidene våre. Vi har vurdert disse som nødvendige, og de lagres derfor uten samtykke.',
155                            linkedCategory: CAT_NECESSARY,
156                            cookieTable: {
157                                caption: 'Vi bruker disse informasjonskapslene',
158                                headers: {
159                                    name: 'Navn',
160                                    domain: 'Tjeneste',
161                                    desc: 'Beskrivelse',
162                                    expiration: 'Utløpstid'
163                                },
164                                body: [
165                                    {
166                                        name: 'CookieConsent',
167                                        domain: 'Fredrikstad kommune',
168                                        desc: 'Administrasjon av samtykke',
169                                        expiration: '90 dager'
170                                    },
171                                ]
172                            }
173                        },
174                        {
175                            title: 'Innbyggertjenester',
176                            description: '',
177                            linkedCategory: CAT_FUNCTIONALITY,
178                            cookieTable: {
179                                caption: 'Vi bruker disse informasjonskapslene',
180                                headers: {
181                                    name: 'Navn',
182                                    domain: 'Tjeneste',
183                                    desc: 'Beskrivelse',
184                                    expiration: 'Utløpstid'
185                                },
186                                body: [
187                                    {
188                                        name: 'AspNetCore.Cookies',
189                                        domain: 'Fredrikstad Kommune',
190                                        desc: 'Brukes for å identifisere brukere av Min Side',
191                                        expiration: '24 timer'
192                                    },
193                                    {
194                                        name: 'AspNetCore.Antiforgery',
195                                        domain: 'Fredrikstad Kommune',
196                                        desc: 'Brukes for å beskytte mot angrep mot nettstedet',
197                                        expiration: 'NÃ¥r nettleseren lukkes'
198                                    },
199                                    {
200                                        name: 'kari_guid',
201                                        domain: 'fredrikstad.kommune.no',
202                                        desc: 'Brukes av Kommune-Kari for å skille samtaler fra hverandre',
203                                        expiration: '15 minutter'
204                                    }
205                                ]
206                            }
207                        },
208                        {
209                            title: 'Statistikk og analyse',
210                            description: 'Disse samler informasjon om hvordan du bruker nettsidene våre. All innsamlet data er anonymisert, og kan ikke brukes til å identifisere deg.',
211                            linkedCategory: CAT_ANALYTICS,
212                            cookieTable: {
213                                caption: 'Vi bruker disse informasjonskapslene',
214                                headers: {
215                                    name: 'Navn',
216                                    domain: 'Tjeneste',
217                                    desc: 'Beskrivelse',
218                                    expiration: 'Utløpstid'
219                                },
220                                body: [
221                                    {
222                                        name: '_ga',
223                                        domain: 'Google Analytics',
224                                        desc: 'Brukes av Google Analytics for å skille brukere fra hverandre',
225                                        expiration: '13 måneder'
226                                    },
227                                    {
228                                        name: '_gid',
229                                        domain: 'Google Analytics',
230                                        desc: 'Brukes av Google Analytics for statistikk og trafikkmåling',
231                                        expiration: '24 timer'
232                                    },
233                                    {
234                                        name: '_clck',
235                                        domain: 'Microsoft Clarity',
236                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
237                                        expiration: '12 måneder'
238                                    },
239                                    {
240                                        name: '_clsk',
241                                        domain: 'Microsoft Clarity',
242                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
243                                        expiration: '24 timer'
244                                    },
245                                    {
246                                        name: 'CLID',
247                                        domain: 'Microsoft Clarity',
248                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
249                                        expiration: '12 måneder'
250                                    },
251                                    {
252                                        name: 'ANONCHK',
253                                        domain: 'Microsoft Clarity',
254                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
255                                        expiration: '10 minutter'
256                                    },
257                                    {
258                                        name: 'MR',
259                                        domain: 'Microsoft Clarity',
260                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
261                                        expiration: '7 dager'
262                                    },
263                                    {
264                                        name: 'MUID',
265                                        domain: 'Microsoft Clarity',
266                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
267                                        expiration: '13 måneder'
268                                    },
269                                    {
270                                        name: 'SM',
271                                        domain: 'Microsoft Clarity',
272                                        desc: 'Brukes av Microsoft Clarity for statistikk og trafikkmåling',
273                                        expiration: 'NÃ¥r nettleseren lukkes'
274                                    },
275                                ]
276                            }
277                        },
278                        {
279                            title: 'Mer informasjon',
280                            description: 'Mer informasjon om hvordan vi bruker cookies kan du lese i <a href="/personvern/">erklæringen vår om Personvern og Informasjonskapsler</a>.'
281                        }
282                    ]
283                }
284            }
285        }
286    }
287});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.