Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$crisp example and other does not work #98

Closed
green-cats opened this issue Jun 20, 2022 · 6 comments
Closed

$crisp example and other does not work #98

green-cats opened this issue Jun 20, 2022 · 6 comments
Assignees

Comments

@green-cats
Copy link

green-cats commented Jun 20, 2022

Hi, very cool feature, but I failed to implement any example, even direct copy - paste...
Nuxt 3, In console log I can see worker, but can't see chat button, also window.$crisp return a strange function instead of the $crisp object, I tried call this function like window.$crisp() -> undefined

Thank you

@danielroe
Copy link
Contributor

Would you provide a reproduction? 🙏

@P4sca1
Copy link

P4sca1 commented Oct 4, 2022

@danielroe https://stackblitz.com/edit/github-u2eqr4
Comment out type: 'text/partytown' in nuxt.config.ts line 15 and you will see the crisp widget in the bottom right corner. With partytown enabled, crisp does not work.

@lnfel
Copy link

lnfel commented Dec 10, 2022

Apparently the same thing is happening when partytown is used in an HTML project (no framework). Was looking for similar issue and it brought me here so I might just add more info on the matter.

Sample code in my html file:

<script>
  window.$crisp=[];
  window.CRISP_WEBSITE_ID="some-id-here";
</script>
<script type="text/partytown" defer src="https://client.crisp.chat/l.js"></script>

Crisp's l.js script successfully ran by partytown but upon executing client.js (called by l.js) I receive an error:

SyntaxError: Unexpected token '(' (at client.js?de6ca11:9:30131)
    at new Function (<anonymous>)
    at run (partytown-ww-sw.js?v=0.7.3:692:9)
    at partytown-ww-sw.js?v=0.7.3:1707:37

Of course if I remove type="text/partytown" on the script tag crisp works fine.

@danielroe
Copy link
Contributor

Yes, this is not an issue with the Nuxt module; if you are experiencing an issue in a plain HTML project, the place to raise the issue is at https://github.com/BuilderIO/partytown, not here.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2022
@marcaureln
Copy link

In a matter of fact, this still doesn't work (Crisp isn't showing up).

export default defineNuxtConfig({
  modules: ['@nuxtjs/partytown'],
  partytown: {
    forward: ['$crisp', '$crisp.push'],
  },
  app: {
    head: {
      script: [
        // Insert your CRISP Script here e.g.:
        { innerHTML: 'window.$crisp = []; window.CRISP_WEBSITE_ID = "my-crisp-website-id"' },
        { src: 'https://client.crisp.chat/l.js', async: true, type: 'text/partytown' },
      ],
    },
  },
})

And, simply replacing type: 'text/partytown' with type: 'text/javascrip' fix the issue. And, nothing usefull in log even with debug: true in partytown config.

Copy link
Contributor

It might be that you need now to proxy crisp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants