Does partytown support smartlook? Problelm in integrating smartlook with partytown

118 Views Asked by At

I am trying to integrate smartlook using partytown using this code:

<script type='text/javascript'>
  window.smartlook||(function(d) {
    var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0];
    var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/partytown';
    c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c);
    })(document);
    smartlook('init', PROJECT_KEY, { region: REGION });
</script>

it does not give any errors but does not show anything on the smartlook is there something wrong I am doing?

I have addes this code before all of the headers

 <script type="module">
      import { partytownSnippet } from "@builder.io/partytown/integration";
      const snippetText = partytownSnippet();
      const el = document.createElement("script");
      el.innerText = snippetText;
      document.head.appendChild(el);
    </script>

I have added this to scripts in package.json:

"scripts": {
    "partytown": "partytown copylib public/~partytown"
  },
1

There are 1 best solutions below

1
Adrian Zak On

You have to paste your smart look id inside the script. Each script you want to load with Partytown must have type='text/partytown'.