-
Notifications
You must be signed in to change notification settings - Fork 3
/
base-scripts.php
128 lines (112 loc) · 4.75 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
<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 acceptButton = document.querySelector( ".Kolaciky__button--yes" )
const trialButton = document.querySelector( "button[data-id=createButtonmain]" )
acceptButton.addEventListener( "click", () => {
const demobarNow = document.querySelector( '#demobar' )
if( demobarNow ) {
demobarNow.classList.add( 'visible' )
setTimeout( () => {
demobarNow.classList.add( 'show' )
}, 5000 )
}
gtmWithCookie()
if ( typeof createButton == 'function' ) {
createButton()
}
} )
if ( trialButton !== null ) {
trialButton.addEventListener( "click", () => {
setCookie( 'cookieLaw', 'yes', 14 )
document.querySelector( '.Kolaciky' ).classList.add( 'hide' )
gtmWithCookie();
});
}
</script>
<!-- Google Tag Manager - No Cookies -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W4JBQR9');
</script>
<!-- Google Tag Manager - Accepted Cookies -->
<script>
function gtmWithCookie() {
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-52T6R8B');
}
if ( getCookieFrontend( "cookieLaw" ) ) {
gtmWithCookie()
}
</script>
<!-- LiveAgent - Chat Button -->
<script>
function loadChatBot({ chatbotId, chatbotUserId, btnTarget }) {
const chatBotButton = document.querySelector(btnTarget);
chatBotButton.classList.remove('hidden');
(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://www.urlslab.com/public/w/v1/urlslab-chat-widget.js',
function(e){
const chatbotManager = UrlslabChatbot.initChatbot({
showChatButton: false, // important to not show chat button on page load
chatbotId: chatbotId,
chatbotUserId: chatbotUserId,
welcomeMessage: 'Hi, I\'m PostAffiliatePro Bot. How can I help you?',
inputPlaceholder: 'Ask me any question...',
suggestedUserMessages: [],
urlSuffix: '?utm_medium=chatbot&utm_source=urlslab',
maxWindowWidth: '500px',
});
chatBotButton.addEventListener('click', () => {
chatbotManager.openChat();
});
});
}
</script>
<?php
if (
! is_page( array( 'request-demo', 'demo', 'call', 'trial', 'thank-you', 'appsumo-signup', 'free-account', 'andrej', 'johngordon', 'michaela', 'tom', 'typing-test', 'tipptest', 'prueba-de-tipeo', 'test-de-saisie', 'test-di-digitazione', 'teste-de-digitacao', 'typetest', 'gepelesi-teszt', 'test-pisania', 'test-na-umenie-nabirat-tekst', 'dazi-ceshi' ) )
&& ! is_post_type_archive( array( 'ms_glossary', 'ms_templates', 'ms_academy', 'ms_directory' ) )
&& ! is_single( array( 'facebook', 'twitter', 'viber', 'instagram' ) )
&& ! is_singular( array( 'ms_glossary', 'ms_templates', 'ms_academy', 'ms_directory', 'ms_about', 'post' ) )
&& ! is_category( array( 'blog', 'news', 'reviews', 'growth', 'support', 'live-chat', 'help-desk-software' ) )
&& ! is_search()
) {
require_once get_template_directory() . '/contactus-box.php';
} elseif (
! is_page( array( 'request-demo', 'demo', 'trial', 'thank-you', 'free-account' ) )
) {
?>
<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: '75caa46f-690e-46da-8e85-74dcfb44d727', chatbotUserId: 'b3JnLnBhYzRqLm9pZGMucHJvZmlsZS5PaWRjUHJvZmlsZToxMDUxMjgzNjQ3MzQxODgyMDI2NzVAQEA3NWNhYTQ2Zi02OTBlLTQ2ZGEtOGU4NS03NGRjZmI0NGQ3Mjc=',}
acceptButton.addEventListener( "click", () => {
loadChatBot(chatBtnOptions);
});
if ( getCookieFrontend( "cookieLaw" ) ) {
loadChatBot(chatBtnOptions);
}
</script>
<?php
}
?>