Jump to content

<script> not showing on page

Recommended Posts

Hello,

I am trying to embed a script on one of the page, its shown in the builder but on real page its not seen:

please help me fix this. thanks

<script>
  var vapiInstance = null;
  const assistant = "";
  const apiKey = "";
  const buttonConfig = {
    position: "center",
    offset: "40px",
    width: "50px",
    height: "50px",
    idle: {
      color: `rgb(93, 254, 202)`, 
      type: "pill",
      title: "Expirance Sales with AI!",
      subtitle: "Talk with James our AI sales agent ",
      icon: `https://unpkg.com/lucide-static@0.321.0/icons/phone.svg`,
    },
    loading: {
      color: `rgb(93, 124, 202)`,
      type: "pill",
      title: "Connecting...",
      subtitle: "Please wait",
      icon: `https://unpkg.com/lucide-static@0.321.0/icons/loader-2.svg`,
    },
    active: {
      color: `rgb(255, 0, 0)`,
      type: "pill",
      title: "Call is in progress...",
      subtitle: "End the call.",
      icon: `https://unpkg.com/lucide-static@0.321.0/icons/phone-off.svg`,
    },
  };

  (function (d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = "https://cdn.jsdelivr.net/gh/VapiAI/html-script-tag@latest/dist/assets/index.js";
    g.defer = true;
    g.async = true;
    s.parentNode.insertBefore(g, s);

    g.onload = function () {
      vapiInstance = window.vapiSDK.run({
        apiKey: apiKey,
        assistant: assistant,
        config: buttonConfig,
      });

      // Attach event listeners after the vapiInstance is initialized
      vapiInstance.on('speech-start', () => {
        console.log('Speech has started');
      });

      vapiInstance.on('speech-end', () => {
        console.log('Speech has ended');
      });

      vapiInstance.on('call-start', () => {
        console.log('Call has started');
      });

      vapiInstance.on('call-end', () => {
        console.log('Call has stopped');
      });

      vapiInstance.on('volume-level', (volume) => {
        console.log(`Assistant volume level: ${volume}`);
      });

      vapiInstance.on('message', (message) => {
        console.log(message);
      });

      vapiInstance.on('error', (e) => {
        console.error(e);
      });
    };
  })(document, "script");
</script>


 

 

Link to comment
  • Replies 7
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

another question, the person invented the sqaurespace design, should be fired...really. this is a disaster, want to change text of some form, i need to do 10000 clicks to find the F***ing thing!

 

Link to comment
On 4/1/2024 at 5:39 PM, ShayR said:

i tried , it didn't help,.....any other idea to solve this?
btw does squarespace has a built in affiliate program that I can use? 

 

 

#1. If it works, it will show something or?

#2. Yes, SS has affiliate program

https://www.squarespace.com/affiliates

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.