The is_user_logged_in() function is a WordPress function that checks if a user is logged in. You can customize the event names and categories as needed. Testing: After making these changes, it's essential to test the tracking to ensure it's working as expected. Please note that this second method requires coding knowledge and may require ongoing maintenance as your theme and tracking requirements change. Additionally, make sure you have proper consent and comply with privacy regulations when tracking user activity, especially for logged-in users.