Total Complexity | 7 |
Complexity/F | 1.75 |
Lines of Code | 33 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | /* global dataFlyntFeatureGoogleAnalytics, Cookies */ |
||
3 | import 'file-loader?name=vendor/js-cookie.js!js-cookie/src/js.cookie' |
||
4 | |||
5 | const data = dataFlyntFeatureGoogleAnalytics |
||
6 | |||
7 | export function optOut () { |
||
8 | let confirmOptout = false |
||
|
|||
9 | |||
10 | if (data.confirm) { |
||
11 | confirmOptout = window.confirm(data.confirm) |
||
12 | } else { |
||
13 | confirmOptout = true |
||
14 | } |
||
15 | |||
16 | if (confirmOptout) { |
||
17 | window['ga-disable-' + data.gaId] = true |
||
18 | if (data.success) { |
||
19 | window.alert(data.success) |
||
20 | } |
||
21 | setOptoutCookie() |
||
22 | } |
||
23 | } |
||
24 | |||
25 | export function isOptout () { |
||
26 | return getOptoutCookie() |
||
27 | } |
||
28 | |||
29 | function setOptoutCookie () { |
||
30 | Cookies.set('disableGa', true) |
||
31 | } |
||
32 | |||
33 | function getOptoutCookie () { |
||
34 | return Cookies.get('disableGa') |
||
35 | } |
||
36 |