vue.jsnuxt3.jslivechat

Integrate LiveChat button with Nuxt3


I tried to add Live Chat button with Nuxt 3.

I can see button history in admin panel. But button does not appear on site

I tried to add Live Chat button with Nuxt 3.

There id code that I have to add before .

//nuxt.config.ts

export default defineNuxtConfig({
  ...,
  app: {
   head: {
    script: {
     ...,
     {
      innerHTML:
       `(function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='%%%';s.defer=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://%%%.ladesk.com/scripts/track.js',function(e){ LiveAgent.createButton('%%%', e); });`,
      type: 'text/javascript',
     }
    }
   }
  }
})

I tried to add app=>body=>script, but it does not work. How can I add code to Body?


Solution

  • Resolved by adding 'body: true' after 'innerHTML'