<!DOCTYPE html>
<html>
<head>
<script>
document.addEventListener("DOMContentLoaded", function () {
// Chat aperta
window.addEventListener("keplero_chat_aperta", (e) => {
console.log("✅ Chat aperta:", e.detail);
// Esempio: Traccia nelle analytics
// gtag('event', 'chat_aperta', { chatbot_id: e.detail.chatbotId });
});
// Chat chiusa
window.addEventListener("keplero_chat_chiusa", (e) => {
console.log("❌ Chat chiusa:", e.detail);
// Esempio: Traccia nelle analytics
// gtag('event', 'chat_chiusa', { chatbot_id: e.detail.chatbotId });
});
// Interazione utente (messaggio inviato)
window.addEventListener("keplero_chat_interaction", (e) => {
console.log("💬 Interazione utente:", e.detail);
// Esempio: Traccia nelle analytics
// gtag('event', 'chat_messaggio_inviato', {
// chatbot_id: e.detail.chatbotId,
// session_id: e.detail.sessionId
// });
});
// Chat aperta per 60 secondi
window.addEventListener("keplero_chat_interaction_60sec", (e) => {
console.log("⏱️ Chat aperta per 60 secondi:", e.detail);
// Esempio: Traccia il coinvolgimento
// gtag('event', 'chat_coinvolgimento_60s', { chatbot_id: e.detail.chatbotId });
});
});
</script>
</head>
<body>
<kepleroai-chat chatbot="your-chatbot-id" side="right"></kepleroai-chat>
</body>
</html>