I would like to add a js script with an @click on a button.
I already tried to do it with InnerHTML and a Node but that's not working.
Do someone have any idea on how to do it ?
Here is my not working code :
addGtmScript: function(company){
gtmScript = document.innerHTML += `
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'register-form-ok',
'company': ${ company },
});
</script>`
document.querySelector('body').innerHTML += gtmScript
},