Adding Loggedin user info into Drift chat

In case one wants to add logged in user email into Drift chat:

<script>
    document.addEventListener("DOMContentLoaded", function() {    
        if(window.logged_in_user && window.drift) {
            const email = window.logged_in_user.softr_user_email;
            drift.on('ready', function() {
                drift.api.setUserAttributes({
                    email: email
                });
            });
        }
    });
</script>