Added userID and URL to Chatwoot Script

This commit is contained in:
2026-03-10 14:49:50 -04:00
parent 508a86d16c
commit a047144922

View File

@@ -24,5 +24,23 @@
}
})(document,"script");
</script>
<script>
window.addEventListener('chatwoot:ready', function () {
// 1. Identify the user (use your real variables/server-side values)
window.$chatwoot.setUser("{{ current_user.id }}", { // or just a string like "user-123"
identifier: "{{ current_user.id }}",
name: "{{ current_user.name }}",
email: "{{ current_user.email }}",
// identifier_hash: "your-hmac-hash-if-using-verification",
});
// 2. Send current URL + extras
window.$chatwoot.setCustomAttributes({
current_page_url: window.location.href,
// e.g. user_plan: "premium",
// last_action: "viewed_pricing"
});
});
</script>
</body>
</html>