We'll transform the script and encapsulate it in a function that allows the script to launch (the launchSellsy function).
<scripttype="text/javascript"> function launchSellsy(){ var el =document.createElement('script'); el.setAttribute('src', 'https://www.sellsy.fr/?_f=snippet&hash=JUU0JUY4JThFJTgyLSU4QSVFQyVCRiVBQiVBRSUyMyVBNyVENmolQzMlMjUlRkIlOTglQUIlQzAlRjQlMTN4JUJBJUFDQiUwQSVFRnUlMDElQUElQUJhJTI3JTBCJUM5JThDJTJDJTI2byVCNSUxMDFJNiUwMiU4MiU5NiVFNiVFNiVBMTclQjAlOTclMDlPRCVENSVBNyUxOCVENiVCRiU2MCUzQw==');
document.head.append(el); }
Then we take back the function that allows script launches in the Axeptio back office, and we organize it so that if the user chooses Sellsy it launches the function that executes the Sellsy script.
We'll then simply add the full script right after the SDK which will look like :
<scripttype="text/javascript">//Le sdk qui permet de lancer le widget Axeptio et de sauvegarder les acceptationswindow.axeptioSettings = { clientId: "5c11ff5ce95cd64112feab79",};(function(d, s) { var t =d.getElementsByTagName(s)[0], e =d.createElement(s);e.async =true; e.src ="//static.axept.io/sdk.js";t.parentNode.insertBefore(e, t);})(document, "script");// La fonction qui permet de lancer SellSy function launchSellsy(){ var el =document.createElement('script'); el.setAttribute('src', 'https://www.sellsy.fr/?_f=snippet&hash=JUU0JUY4JThFJTgyLSU4QSVFQyVCRiVBQiVBRSUyMyVBNyVENmolQzMlMjUlRkIlOTglQUIlQzAlRjQlMTN4JUJBJUFDQiUwQSVFRnUlMDElQUElQUJhJTI3JTBCJUM5JThDJTJDJTI2byVCNSUxMDFJNiUwMiU4MiU5NiVFNiVFNiVBMTclQjAlOTclMDlPRCVENSVBNyUxOCVENiVCRiU2MCUzQw==');
document.head.append(el); }// La fonction qui relie Axeptio au lancement du cookie Sellsy void 0 === window._axcb && (window._axcb = []); window._axcb.push(function(axeptio) {axeptio.on("cookies:complete",function(choices) {if(choices.Sellsy) {launchSellsy(); } }); }); </script>
Congrats ! the Sellsy chat now only appears after the user agreed to it