Hey everyone,
I’m currently working on integrating Google Analytics 4 (GA4) with softr.io to track the login status of my users. Here’s the code snippet I’ve implemented:
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR-ID"></script>
<script>
if (window.logged_in_user && window.logged_in_user['softr_user_email']) {
gtag('event', 'user_status', {'User_Status': 'logged in'});
} else {
gtag('event', 'user_status', {'User_Status': 'not logged in'});
}
</script>
Has anyone here tried a similar approach? I’d like to know if this works well for others and if there are any pitfalls or optimizations I should be aware of.
Any feedback would be greatly appreciated! Thanks in advance for your help.
Best regards,