AFAIK that is impossible
I can only assume ecosia share this data with Microsoft because doing so has allowed them to land a more lucrative deal.
Not sure how DDG and other search engines that rely on Bing does it, but it’s certainly possible without sharing the users’ IP with Microsoft.
So it is probably possible.