Kayako Code Snippet

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi,

I can't make this snippet work on a test instance of NOPCommerce  4.20. I added it on just before the </body> tag of ./Views/Shared/_Root.Head.cshtml but it won't display. Any suggestions?

<script>(function(d,a){function c(){var b=d.createElement("script");b.async=!0;b.type="text/javascript";b.src=a._settings.messengerUrl;b.crossOrigin="anonymous";var c=d.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}window.kayako=a;a.readyQueue=[];a.newEmbedCode=!0;a.ready=function(b){a.readyQueue.push(b)};a._settings={apiUrl:"https://xxx.kayako.com/api/v1",messengerUrl:"https://xxx.kayakocdn.com/messenger",realtimeUrl:"wss://kre.kayako.net/socket"};window.attachEvent?window.attachEvent("onload",c):window.addEventListener("load",c,!1)})(document,window.kayako||{});</script>
3 years ago
DirectFocus wrote:
Hi,

I can't make this snippet work on a test instance of NOPCommerce  4.20. I added it on just before the </body> tag of ./Views/Shared/_Root.Head.cshtml but it won't display. Any suggestions?

<script>(function(d,a){function c(){var b=d.createElement("script");b.async=!0;b.type="text/javascript";b.src=a._settings.messengerUrl;b.crossOrigin="anonymous";var c=d.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}window.kayako=a;a.readyQueue=[];a.newEmbedCode=!0;a.ready=function(b){a.readyQueue.push(b)};a._settings={apiUrl:"https://xxx.kayako.com/api/v1",messengerUrl:"https://xxx.kayakocdn.com/messenger",realtimeUrl:"wss://kre.kayako.net/socket"};window.attachEvent?window.attachEvent("onload",c):window.addEventListener("load",c,!1)})(document,window.kayako||{});</script>



Hi

try to add location may be it working.

<script asp-location="Footer">(function (d, a) { function c() { var b = d.createElement("script"); b.async = !0; b.type = "text/javascript"; b.src = a._settings.messengerUrl; b.crossOrigin = "anonymous"; var c = d.getElementsByTagName("script")[0]; c.parentNode.insertBefore(b, c) } window.kayako = a; a.readyQueue = []; a.newEmbedCode = !0; a.ready = function (b) { a.readyQueue.push(b) }; a._settings = { apiUrl: "https://xxx.kayako.com/api/v1", messengerUrl: "https://xxx.kayakocdn.com/messenger", realtimeUrl: "wss://kre.kayako.net/socket" }; window.attachEvent ? window.attachEvent("onload", c) : window.addEventListener("load", c, !1) })(document, window.kayako || {});</script>
3 years ago
DirectFocus wrote:
I added it on just before the </body> tag of ./Views/Shared/_Root.Head.cshtml but it won't display.

Maybe that is a silly question, but have you restarted the application when added code? Any change at the files at 4.20 requires to be restarted.

Regards,
Tom
3 years ago
Yes I did restart.

I found a work around for this. I enabled the Google Tag plugin and inserted the code snippet there.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.