A specialized keyboard using different button layouts and settings per app. Also, not tracking keystrokes at all but rather "used special keyboard with app foo".
As a better example, suppose it were a game controller. Then the question "what games are people using this controller with?" seems quite reasonable. Filter to games only and anonymize the data and that would be fine.