-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathklaro-config.js
152 lines (137 loc) · 4.75 KB
/
klaro-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import * as Klaro from 'klaro/dist/klaro-no-css'
const config = {
htmlTexts: true,
embedded: false,
cookieExpiresAfterDays: 30,
default: false,
mustConsent: false,
acceptAll: true,
hideLearnMore: true,
translations: {
en: {
privacyPolicyUrl: 'https://cdlib.org/about/policies-and-guidelines/privacy-statement/',
consentNotice: {
description:
'<h1>Cookie Settings</h1><p>The California Digital Library uses cookies to ensure you have the best experience on our website. ' +
'You can manage which cookies you want us to use.</p><p>Our <a href=https://cdlib.org/about/policies-and-guidelines/privacy-statement/ target=_blank>Privacy Statement</a> includes ' +
'more details on the <a href="https://cdlib.org/about/policies-and-guidelines/privacy-policy/#cookie-notice" target="_blank">cookies we use</a> and how we protect your privacy.<p>'
},
consentModal: {
// Klaro's consent modal is not used at CDL.
},
decline: 'Allow only necessary cookies',
ok: 'Allow all cookies',
purposes: {
analytics: {
title: 'Analytics'
},
security: {
title: 'Security'
},
livechat: {
title: 'Livechat'
},
advertising: {
title: 'Advertising'
},
styling: {
title: 'Styling'
}
}
}
},
/*
Here you specify the third-party services that Klaro will manage for you.
*/
services: [
{
/*
Each service must have a unique name. Klaro will look for HTML elements with a
matching 'data-name' attribute to identify elements that belong to this service.
*/
name: 'matomo-tracking',
/*
If 'default' is set to 'true', the service will be enabled by default. This
overrides the global 'default' setting.
*/
default: true,
/*
Translations belonging to this service go here. The key `zz` contains default
translations that will be used as a fallback if there are no translations
defined for a given language.
*/
translations: {
zz: {
title: 'Matomo/Piwik'
},
en: {
description: 'Matomo is a simple, self-hosted analytics service.'
}
},
/*
The purpose(s) of this service that will be listed on the consent notice. Do not
forget to add translations for all purposes you list here.
*/
purposes: ['analytics'],
cookies: [
/*
This rule will match cookies that contain the string '_pk_' and that are set on
the path '/' and the domain 'klaro.kiprotect.com'
*/
[/^_pk_.*$/, '/', 'klaro.kiprotect.com'],
/*
Same as above, only for the 'localhost' domain
*/
[/^_pk_.*$/, '/', 'localhost'],
/*
This rule will match all cookies named 'piwik_ignore' that are set on the path
'/' on the current domain
*/
'piwik_ignore'
],
/*
You can define an optional callback function that will be called each time the
consent state for the given service changes. The consent value will be passed as
the first parameter to the function (true=consented). The `service` config will
be passed as the second parameter.
*/
callback: function (consent, service) {
console.log(
'User consent for service ' + service.name + ': consent=' + consent
)
},
/*
If 'required' is set to 'true', Klaro will not allow this service to be disabled
by the user. Use this for services that are always required for your website to
function (e.g. shopping cart cookies).
*/
required: false,
/*
If 'optOut' is set to 'true', Klaro will load this service even before the user
has given explicit consent. We strongly advise against this.
*/
optOut: false,
/*
If 'onlyOnce' is set to 'true', the service will only be executed once
regardless how often the user toggles it on and off. This is relevant e.g. for
tracking scripts that would generate new page view events every time Klaro
disables and re-enables them due to a consent change by the user.
*/
onlyOnce: true
}
],
/*
You can define an optional callback function that will be called each time the
consent state for any given service changes. The consent value will be passed as
the first parameter to the function (true=consented). The `service` config will
be passed as the second parameter.
*/
callback: function (consent, service) {
console.log(
'User consent for service ' + service.name + ': consent=' + consent
)
}
}
window.klaro = Klaro
window.klaroConfig = config
Klaro.setup(config)