Closed franciscop closed 3 weeks ago
You don't need to pass anything. Umami will figure it our from the IP alone.
Sorry, this is in Node.js, so how does Umami know the IP with this code? When using e.g. Express, wouldn't I need to pass the IP of the client somehow? I believe right now Umami is receiving+using my hosting provider's IP address instead of the client's one with this code:
import umami from '@umami/node';
umami.init({
websiteId: '...', // Your website id
hostUrl: '...'
});
// Where do I put either `req` or `ip`?
var ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress
// Without passing an IP, the "IP" of this request is the hosting one, not the client's one
umami.track({ url: '/home' });
Never mind, I found this to know how to pass it!
How do you make sure to pass the proper data to determine the location with Umami? Country-level would def be enough for me, I'd guess it's either with the
IP
or with thelanguage
region? So what kind of option can I set in Node.js for this?