-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
193 lines (153 loc) · 5.81 KB
/
index.html
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<html>
<head>
<meta charset="UTF-8">
<style>
body {
font-family: 'Arial';
background-image: linear-gradient(45deg, #dfdfdf 25%, transparent 25%), linear-gradient(-45deg, #dfdfdf 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dfdfdf 75%), linear-gradient(-45deg, transparent 75%, #dfdfdf 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
body > button {
margin: 0;
padding: 0;
}
body > button > a {
padding: 1em;
}
</style>
<script src="./build/cookieconsent.min.js"></script>
</head>
<body>
<button><a id="optoutFacebook">Deactivate Facebook tracking</a></button>
<button><a id="reset-consent">Reset consent</a></button>
<script>
var consent = CookieConsent({
// When the settings cookie will expire and the dialog is shown again, default 365
expiresInDays: 365,
// Optional: Don't prompt again when new groups or cookies added, default false.
ignoreNewGroups: false,
// Optional: Prompt on new groups but not cookies, default false.
ignoreNewCookies: false,
// Optional: Reload page after optout, if optoutSuccess text is defined a alert message is shown before, default false.
optoutReload: true,
// Optional: Only look for optout links at given site uri, default none
// optoutURI: 'data-policy',
// Optional: Callback when a cookie got opted out
//onOptout: function( cookieID ) {},
// A element with the id "reset-consent" will attempt to delete all cookies for the page (won't work for HttpOnly or with path set)
consentReset: true,
// Optional: Callback when the consent has been reset
// onConsentReset: function() {}
// Optional: Kind of buttons to use, available is allowCookies, allowSelection and rejectCookies
// buttons: [ 'allowCookies', 'rejectCookies' ],
// Translations
text: {
day: [ 'Day', 'Days' ],
year: [ 'Year', 'Years' ],
allowCookies: 'Allow Cookies',
allowSelection: 'Allow Selection',
rejectCookies: 'Reject Cookies',
details: 'Settings',
name: 'Name',
provider: 'Provider',
expiration: 'Expiration',
type: 'Type',
purpose: 'Purpose',
optoutAlready: 'You have already deactivated this function.',
optoutSuccess: 'Successfully deactivated.',
changes: '<p class="cc-changed">We got new cookies</p>',
consentReset: 'You have objected your consent, notice not all cookies can be deleted now and will stay until they expire.',
message: 'In order to make our site user friendly as possible and improve our services, we are using cookies. For more informations about cookies please see our <a href="/datenschutz/" target="_blank">privacy-policy</a>.'
},
// Cookie groups, can be required (disabled) and pre-selected setting default to true.
groups: [
{
label: 'Essential',
name: 'essential',
required: true,
default: true,
purpose: 'Essential cookies help us making our site run by enabling functions as navigation to protected areas. Without our website cannot work properly.',
cookies: [
{
name: 'cookieSettings',
provider: 'Our Website',
purpose: '',
type: 'HTTP',
expires: '1 year'
},
{
name: 'PHPSESSID',
expires: '395 day',
provider: 'Our Website'
}
]
},
{
label: 'Marketing',
name: 'marketing',
default: true,
purpose: 'Marketing-Cookies are used to follow traffic on our website. The intention is to improve our services and only show you ads that are relevant to you with the help of third party services.',
cookies: [
{
name: '_fbp',
expires: '90 day',
provider: 'Facebook',
type: 'Pixel',
id: 'fbConversions',
optoutElement: 'optoutFacebook',
mount: function() {
}
},
{
name: '_ga, _gid, _giad, _gat, _dc_gtm_xxx, _gat_gtag_xxx, _gac_xxx, IDE',
expires: '395 day',
provider: 'Google',
id: 'GA',
// Script urls can be defined which will be loaded when consent is given
// scripts: [ 'https://www.googletagmanager.com/gtag/js' ]
},
/* First give consent, then enable this to get prompted again about changes
{
name: '_ga, _gid, _giad, _gat',
expires: '395 day',
provider: 'Google',
id: 'GAC',
mount: function() {
}
}*/
]
}
]
});
// You can wait for permission in later callbacks, feedback can be used multiple times for every cookie block definition
consent.feedback( 'fbConversions', function( allowed ) {
var text = document.createElement('div');
text.textContent = 'Facebook ' + ( allowed ? 'allowed' : 'denied' );
document.body.appendChild( text );
});
consent.feedback( 'GA', function( allowed ) {
var text = document.createElement('div');
text.textContent = 'Google Analytics ' + ( allowed ? 'allowed' : 'denied' );
document.body.appendChild( text );
/* Your actual code might look like:
if ( allowed ) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
var gaProp = 'PROPERTY-ID';
ga('create', gaProp, 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
}
*/
});
consent.feedback( 'GAC', function( allowed ) {
var text = document.createElement('div');
text.textContent = 'Google Conversions ' + ( allowed ? 'allowed' : 'denied' );
document.body.appendChild( text );
});
</script>
</body>
</html>