We implemented first party tracking using the basic JS SDK on the browser and pointing the payload to our servers like this:
amplitude.init(AMPLITUDE_API_KEY, {
serverUrl: serverUrl,
autocapture: {
attribution: {
excludeReferrers: [/domain1\.com$/, /domain2\.com$/],
},
formInteractions: false,
fileDownloads: false,
},
});
Everything worked fine till we realized that the IP of every event was being set as our server IP instead of the user. We understood that this is expected and changed the code to send the IP on every event, and it started working:
if (userIp) {
eventOptions.ip = userIp;
}
amplitude.track('ourEvent', eventProperties, eventOptions);
This works, but begs the question: can we set the IP at the SDK level instead of sending on every single event?
And the other question, the more important one but related if we solve the above:
How to set the IP for native events like startSession and pageView? We cannot push eventOptions on those.
I have been told that this is not possible, but this would a major roadblock on first part implementations. Any ideas?