Enrichment
The following table indicates whether each event property is automatically collected by the API and SDKs.
| Property | API | JavaScript SDK | Android/iOS SDK | Other SDKs |
|---|---|---|---|---|
user |
✓1 | ✓1 | ✓1 | ✓1 |
connectionId |
✓2 | ✓1 | ✓1 | ✓1 |
anonymousId |
✓2 | ✓ | ✓ | ✓2 |
channel |
||||
category |
||||
context.app |
✓ | |||
context.browser |
✓1 | ✓1 | ||
context.campaign |
✓ | |||
context.device |
✓ | |||
context.ip - see IP address |
✓2 | ✓2 | ✓2 | ✓2 |
context.library |
✓ | ✓ | ✓ | |
context.locale |
✓ | ✓ | ||
context.location - see Location |
✓2 | ✓2 | ||
context.network |
✓ | ✓ | ||
context.os |
✓1 | ✓1 | ||
context.page |
✓ | |||
context.screen |
✓ | |||
context.session |
✓ | ✓ | ||
context.timezone |
✓ | ✓ | ||
context.userAgent |
✓ | ✓ | ||
event |
||||
groupId |
||||
messageId |
✓2 | ✓ | ✓ | ✓ |
name |
||||
properties |
||||
receivedAt |
✓1 | ✓1 | ✓1 | ✓1 |
sentAt |
✓2 | ✓ | ✓ | ✓ |
originalTimestamp |
✓2 | ✓2 | ✓2 | ✓2 |
timestamp |
✓2 | ✓ | ✓ | ✓ |
traits |
||||
type |
✓ | ✓ | ✓ | |
previuosId |
||||
userId |
IP address
When using the JavaScript SDK, Android SDK, or iOS SDK, the event's IP address is automatically derived from the HTTP request when not explicitly provided. The IP address is resolved as follows:
- If the
context.ipfield is provided, that value is used - Otherwise, if the request includes the
X-Forwarded-Forheader, the IP address is taken from that header - Otherwise, the client's IP address is used
- If the resulting value is invalid or cannot be parsed, the event is discarded
The resolved IP is stored in the context.ip field.
When using a different SDK or sending events directly through the API, the IP address must be explicitly provided in the context.ip. Otherwise, the event will not include an IP address.
Special IPs and privacy
All SDKs and applications support a set of special IP values that let you control how the event's IP address is determined or masked. These values can be used either to adjust the default behavior or to respect user privacy when needed.
| Special IP | Description |
|---|---|
| 255.255.255.255 | Uses the IP address from the HTTP request. |
| 255.255.255.0 | Mask the request IP with 255.255.255.0, setting the last segment to 0 (e.g., 192.168.45.32 → 192.168.45.0). Use this for partial anonymization. |
| 255.255.0.0 | Mask the request IP with 255.255.0.0, setting the last two segments to 0 (e.g., 192.168.45.32 → 192.168.0.0). Use this for stronger anonymization. |
| 0.0.0.0 | The event will not include an IP address. Use this when no IP is applicable or when it should not be associated for privacy reasons. |
Location
Krenalis determines a user's approximate geographic location by using the IP address of their device. It then automatically populates context.location with the following data:
- City
- Country
- Latitude
- Longitude
To enable this feature, you need to obtain the GeoIP database provided by MaxMind. This database contains the IP-to-location mappings required by Krenalis.
Setup
- Visit the MaxMind website and create an account.
- Navigate to GeoIP / GeoLite → Download Files → GeoLite City and select Download GZIP.
- Review the license included in the downloaded package.
- Copy the
GeoLite2-City.mmdbfile to the server where Krenalis is running. - Set the
KRENALIS_MAXMIND_DB_PATHenvironment variable at startup (for example, in the .env file) to point to theGeoLite2-City.mmdbfile.
When context.location is not automatically populated
Krenalis will not populate context.location automatically in the following cases:
- The event includes a manually specified value for
context.location. - The event includes
context.ipset to0.0.0.0. context.ipis not provided and the event was not sent using the JavaScript SDK, Android SDK or iOS SDK.- Krenalis was started without the
KRENALIS_MAXMIND_DB_PATHenvironment variable set. - The IP address is not found in the MaxMind database referenced by
KRENALIS_MAXMIND_DB_PATH.