Added userID and URL to Chatwoot Script
This commit is contained in:
@@ -24,5 +24,23 @@
|
|||||||
}
|
}
|
||||||
})(document,"script");
|
})(document,"script");
|
||||||
</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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user