-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugin-analytics.html
133 lines (117 loc) · 4.31 KB
/
plugin-analytics.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
<!-- Plugin by Cory Chaplin ([email protected]) - http://www.europnet.org - 04/2020 -->
<script>
function loadAnalytics() {
let gaScript = document.createElement('script');
gaScript.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=UA-36932919-2');
document.head.appendChild(gaScript);
}
loadAnalytics();
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-36932919-2', {
'page_title' : 'Login',
'page_path': '/login'
});
gtag('event', 'Login', {
event_category: 'KiwiV2',
event_label: 'Ready',
value: true
});
/* gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
ga('send', {
hitType: 'event',
eventCategory: 'Video',
eventAction: 'play',
eventLabel: 'cats.mp4'
}); */
function loadAds() {
let gadScript = document.createElement('script');
gadScript.setAttribute('src', 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7308685930931350');
gadScript.setAttribute('crossorigin', 'anonymous');
let consentScript = document.createElement('script');
consentScript.setAttribute('src', 'https://fundingchoicesmessages.google.com/i/pub-7308685930931350?ers=1');
consentScript.setAttribute('nonce', '8E3jRfZNaNqrTM-Ehy_Qqw');
document.head.appendChild(gadScript);
document.head.appendChild(consentScript);
}
setTimeout(doAds, 300000);
function doAds() {
let buffers = kiwi.state.getBuffersWithUser(kiwi.state.getActiveNetwork().id, kiwi.state.getActiveNetwork().nick);
// Check channels & male
if((_.invoke(kiwi.state.getActiveNetwork().gecos, "match", /[2-9][0-9] M/) !== undefined) &&
(_.find(buffers, function(value) {
if(value.name == '#sexe') return true;
if(value.name == '#bdsm') return true;
if(value.name == '#scenario') return true;
if(value.name == '#erotisme') return true;
if(value.name == '#sexcam') return true;
if(value.name == '#sexe-gay') return true;
if(value.name == '#123love') return true;
if(value.name == '#andromede') return true;
if(value.name == '#adultere') return true;
if(value.name == '#algeriens') return true;
return false;
}) !== undefined)) {
console.log('staring');
gtag('event', 'Ads', {
event_category: 'Loaded',
event_label: 'IgniteConsent',
value: true
});
(function() {
function signalGooglefcPresent() {
if (!window.frames['googlefcPresent']) {
if (document.body) {
const iframe = document.createElement('iframe');
iframe.style = 'width: 0; height: 0; border: none; z-index: -1000; left: -1000px; top: -1000px;';
iframe.style.display = 'none';
iframe.name = 'googlefcPresent';
document.body.appendChild(iframe);
} else {
setTimeout(signalGooglefcPresent, 0);
}
}
}
signalGooglefcPresent();
})();
loadAds();
}
}
/* Bind kiwi events to GA */
kiwi.plugin('analytics', function(kiwi) {
kiwi.on('network.connecting', function() {
gtag('event', 'Login', {
event_category: 'KiwiV2',
event_label: 'Connecting',
value: true
});
});
kiwi.on('irc.registered', function() {
gtag('event', 'Server', {
event_category: 'KiwiV2',
event_label: 'Connected',
value: true
});
gtag('event', 'page_view', {
page_path: '/connected',
page_title: 'Connected'
});
});
// Count minutes
setInterval(function(){
if(kiwi.state.getActiveNetwork() !== undefined &&
kiwi.state.getActiveNetwork().state === 'connected') {
gtag('event', 'Minutes', {
event_category: 'KiwiV2',
event_label: '+1',
value: true
});
}
}, 60000);
});
</script>