We'll now transform the script and encapsulate it in a function that will launch the script (the launchZendesk() function).
functionlaunchZendesk(){var el =document.createElement('script');el.setAttribute('src','https://static.zdassets.com/ekr/snippet.js?key=4e15810f-956f-40d6-bcab-59f8768b80c1');el.id ="ze-snippet";document.head.append(el);}
C - Integration on your website
You'll just have to add the code
<scripttype="text/javascript">//Le sdk qui permet de lancer le widget Axeptio et de sauvegarder les acceptations var el = document.createElement('script'); el.setAttribute('src', 'https://static.axept.io/sdk.js'); el.setAttribute('type', 'text/javascript'); el.setAttribute('async', true); el.setAttribute('data-id', '5xxXXxxXXXxxXXXxxXXXa'); el.setAttribute('data-cookies-version', 'XXXXX'); if (document.body !== null) {document.body.appendChild(el); }// La fonction qui permet de lancer Zendesk function launchZendesk(){ var el =document.createElement('script');el.setAttribute('src','https://static.zdassets.com/ekr/snippet.js?key=4e15810f-956f-40d6-bcab-59f8768b80c1');el.id ="ze-snippet";document.head.append(el); } // La fonction qui relie Axeptio au lancement du cookie Zendesk void 0 === window._axcb && (window._axcb = []); window._axcb.push(function(axeptio) {axeptio.on("cookies:complete",function(choices) {if(choices.zendesk) {launchZendesk(); } }); }); </script>