Pixel route.
This commit is contained in:
@@ -87,6 +87,8 @@ export const COLLECTION_TYPE = {
|
||||
export const EVENT_TYPE = {
|
||||
pageView: 1,
|
||||
customEvent: 2,
|
||||
linkEvent: 3,
|
||||
pixelEvent: 4,
|
||||
} as const;
|
||||
|
||||
export const DATA_TYPE = {
|
||||
|
||||
@@ -89,8 +89,8 @@ function decodeHeader(s: string | undefined | null): string | undefined | null {
|
||||
|
||||
export async function getLocation(ip: string = '', headers: Headers, hasPayloadIP: boolean) {
|
||||
// Ignore local ips
|
||||
if (await isLocalhost(ip)) {
|
||||
return;
|
||||
if (!ip || (await isLocalhost(ip))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!hasPayloadIP && !process.env.SKIP_LOCATION_HEADERS) {
|
||||
@@ -130,7 +130,7 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI
|
||||
);
|
||||
}
|
||||
|
||||
const result = globalThis[MAXMIND].get(ip?.split(':')[0]);
|
||||
const result = globalThis[MAXMIND]?.get(ip?.split(':')[0]);
|
||||
|
||||
if (result) {
|
||||
const country = result.country?.iso_code ?? result?.registered_country?.iso_code;
|
||||
|
||||
Reference in New Issue
Block a user