Categorization based on process instead of names

I’d like to be able to categorize based on the process name instead of the window title.
For instance, last week I have ms-teams.exe as uncategorized for 7h 31m, but the window title is "Chat | {person} | {company} | {email} | Microsoft Teams, however adding a category for “Microsoft Teams” does not work.

Additionally, it would be nice to categorize based on the URL rather than the title of the page.