Tagged: google analytics
Hello, I need to insert this code in my website header. And I don´t know how to do it.
:
window.addEventListener(“DOMContentLoaded”, function() {
// Evento de Click en Telefono
document.querySelectorAll(“a[href^=’tel:’]”).forEach((button) => {
button.addEventListener(‘click’, () => {
ga(‘send’, ‘event’, ‘Telefono’, ‘Click’, document.title);
});
});
// Evento de Click en Email
document.querySelectorAll(“a[href^=’mailto:’]”).forEach((button) => {
button.addEventListener(‘click’, () => {
ga(‘send’, ‘event’, ‘Email’, ‘Click’, document.title);
});
});
// Evento de Envio de Formulario
var sentOK = false;
var targetNode = document.querySelector(‘.wpcf7-response-output’);
var observer = new MutationObserver(function(){
if(targetNode.classList.contains(“wpcf7-mail-sent-ok”)&&sentOK==false){
ga(‘send’, ‘event’, ‘Formulario’, ‘Envio’, document.title);
sentOK = true;
}
});
observer.observe(targetNode, { attributes: true, childList: true })
}, false);
Hi,
You will need to open the header.php file and paste the code there.
Best regards,
Basilis
where do i find header php file?
and what about using Header Footer Code Manager?