Tracking User Login Status with Google Analytics and softr.io

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, :sun_behind_large_cloud:

1 Like

Dear Lea,

I need to deal with same case and need to track my registered users with ID.

Do you have any feedback from october if it works ?

Thank you

Danny