zoltalar
zoltalar

Reputation: 170

Integrate LiveChatInc widget with NuxtJs

I'm using NuxtJS for my project and I'm trying to integrate LiveChatInc chat according to this page: https://developers.livechat.com/docs/extending-chat-widget/javascript-api#getting-started

I tried using middleware to enter the JS code but Eslint is giving me errors:

window.__lc = window.__lc || {};
window.__lc.license = <LICENSE_NUMBER>;
;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",c.call(arguments)])},once:function(){i(["once",c.call(arguments)])},off:function(){i(["off",c.call(arguments)])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="https://cdn.livechatinc.com/tracking.js",t.head.appendChild(n)}};!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))

Can someone point me to a right direction? Thank you.

Upvotes: 0

Views: 799

Answers (1)

kissu
kissu

Reputation: 46774

Here is how to add some 3rd party scripts to your Nuxt app, depending of the use case you do need: https://stackoverflow.com/a/67535277/8816585

This is totally normal that ESlint is giving you errors on this kind of code snippet, you don't need to care about those.

Put this at the top of the .js file containing your snippet (you don't need a linter in this kind of file)

// eslint-disable

Upvotes: 1

Related Questions