-
Notifications
You must be signed in to change notification settings - Fork 0
/
base-scripts.php
216 lines (186 loc) · 5.45 KB
/
base-scripts.php
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<script>
const getCookieFrontend = ( name ) => {
const nameEq = `${name}=`
const ca = document.cookie.split( ";" )
for ( let i = 0; i < ca.length; i += 1 ) {
let c = ca[ i ]
while ( c.charAt( 0 ) === " " ) {
c = c.substring( 1, c.length )
}
if ( c.indexOf( nameEq ) === 0 ) {
return c.substring( nameEq.length, c.length )
}
}
return null
}
const mobile = window.matchMedia('(max-width: 768px)');
const acceptButton = document.querySelector( ".Medovnicky__button--yes" );
acceptButton.addEventListener( "click", () => {
consentGranted();
grafana();
postAffiliate();
<?php if ( ! is_page( array( 'request-demo', 'demo', 'trial', 'free-account' ) ) ) { ?>
if ( typeof offlineContactForm == 'function' ) {
offlineContactForm();
}
<?php } ?>
});
</script>
<!-- Post Affiliate Pro -->
<script type="text/javascript">
function postAffiliate() {
(function(d,t) {
var script = d.createElement(t); script.id= 'pap_x2s6df8d'; script.async = true;
script.src = '//pap.qualityunit.com/scripts/m3j58hy8fd';
script.onload = script.onreadystatechange = function() {
var rs = this.readyState; if (rs && (rs != 'complete') && (rs != 'loaded')) return;
PostAffTracker.setAccountId('default1');
if ( !getCookieFrontend( "cookieLaw" ) ) {
try {
PostAffTracker.disableTrackingMethod('C');
PostAffTracker.track();
} catch (e) {}
}
if ( getCookieFrontend( "cookieLaw" ) ) {
try {
PostAffTracker.enableTrackingMethods();
PostAffTracker.track();
} catch (e) {}
}
}
var placeholder = document.getElementById('papPlaceholder');
placeholder.parentNode.insertBefore(script, placeholder);
})(document, 'script');
}
if ( ! mobile.matches ) {
postAffiliate()
}
if ( mobile.matches && getCookieFrontend( "cookieLaw" ) ) {
postAffiliate()
}
</script>
<!-- Grafana -->
<script>
function grafana(cookie = true) {
var _paq = window._paq || [];
window._paq = _paq;
if (cookie === false) {
_paq.push(["disableCookies"]);
}
// _paq.push(['enableLinkTracking']);
_paq.push(['trackPageView']);
_paq.push(['enableCrossDomainLinking']);
(function() {
_paq.push(['setSiteId', 'FH-web']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='//analytics.qualityunit.com/i.js'; s.parentNode.insertBefore(g,s);
})();
}
if ( ! mobile.matches ) {
if ( getCookieFrontend( "cookieLaw" ) ) {
grafana()
} else {
grafana(false)
}
}
if ( mobile.matches && getCookieFrontend( "cookieLaw" ) ) {
grafana()
}
</script>
<!-- Google Tag Manager -->
<script>
function loadGoogle() {
const body = document.body;
const gtag1 = document.createElement('script');
gtag1.async = true;
gtag1.src = "https://www.googletagmanager.com/gtag/js?id=G-T9HBB9KMVK";
body.insertAdjacentElement('beforeend', gtag1);
}
if ( ! mobile.matches ) {
loadGoogle()
}
if ( mobile.matches && getCookieFrontend( "cookieLaw" ) ) {
loadGoogle()
}
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('consent', 'default', {
'ad_user_data': 'granted',
'analytics_storage': 'granted'
})
gtag('consent', 'default', {
'ad_user_data': 'denied',
'analytics_storage': 'denied',
'region': ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IS', 'LI', 'NO']
})
gtag('config', 'G-W2STK077L2', {
'allow_enhanced_conversions': true,
'linker': {
'domains': [
'flowhunt.io',
'support.liveagent.com',
'ladesk.com'
]
}
});
function consentGranted() {
gtag('consent', 'update', {
'ad_user_data': 'granted',
'analytics_storage': 'granted'
})
}
</script>
<!-- End Google Tag Manager -->
<!-- Chat Button Loader -->
<script type="text/javascript" id="fh-chatbot-script-4f954c97-1f1b-4164-82df-1b259ce5f645">
(function(d, src, c) {
var t = d.scripts[d.scripts.length - 1],
s = d.createElement('script');
s.async = true;
s.src = src;
s.onload = s.onreadystatechange = function() {
var rs = this.readyState;
if (rs && (rs != 'complete') && (rs != 'loaded')) {
return;
}
c(this);
};
t.parentElement.insertBefore(s, t.nextSibling);
})(document,
'https://app.flowhunt.io/fh-chat-widget.js',
function(e) {
FHChatbot.initChatbot({
chatbotId: '4f954c97-1f1b-4164-82df-1b259ce5f645',
workspaceId: 'e31db667-893b-4e47-92c3-bb1f93c1b594',
urlSuffix: '#utm_source=chatbot',
maxWindowWidth: '700px',
});
}
);
</script>
<?php
if (
! is_page( array( 'request-demo', 'demo', 'trial', 'thank-you', 'free-account' ) )
) {
?>
<div class="ContactUs__chatBotOnly__wrapper">
<button class="ContactUs__chatBotOnly hidden" id="chatBotOnly" rel="nofollow noopener external">
<img class="ContactUs__icon" src="<?= esc_url( get_template_directory_uri() . '/assets/images/contact/chatbot.svg' ); ?>" />
</button>
<script type="text/javascript" id="urlslab-chatbot-script">
const chatBtnOptions = {btnTarget: '#chatBotOnly', chatbotId: '4f954c97-1f1b-4164-82df-1b259ce5f645', workspaceId: 'e31db667-893b-4e47-92c3-bb1f93c1b594'};
// acceptButton.addEventListener( "click", () => {
// loadChatBot(chatBtnOptions);
// });
//
// if ( getCookieFrontend( "cookieLaw" ) ) {
// loadChatBot(chatBtnOptions);
// }
</script>
</div>
<?php
}
?>