Skip to content

Commit

Permalink
feat: send integration info with request
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Aug 17, 2022
1 parent 77bd0cb commit 0530a76
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/urlUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Region, VisitorHistoryFilter } from './types';
import { version } from '../package.json';

const euRegionUrl = 'https://eu.api.fpjs.io/';
const apRegionUrl = 'https://ap.api.fpjs.io/';
const globalRegionUrl = 'https://api.fpjs.io/';

type QueryStringParameters = VisitorHistoryFilter & {
api_key?: string;
ii: string;
};

export function getVisitorsUrl(
Expand All @@ -14,15 +16,16 @@ export function getVisitorsUrl(
filter?: VisitorHistoryFilter,
apiKey?: string
): string {
const queryStringParameters: QueryStringParameters = filter ?? {};
const queryStringParameters: QueryStringParameters = {
...filter,
ii: `fingerprint-pro-server-node-sdk/${version}`,
};
if (apiKey) {
queryStringParameters.api_key = apiKey;
}

const serverApiPath = getVisitorsPath(region, visitorId);
const queryString = queryStringParameters
? serializeQueryStringParams(queryStringParameters)
: '';
const queryString = serializeQueryStringParams(queryStringParameters);

if (queryString === '') {
return serverApiPath;
Expand Down

0 comments on commit 0530a76

Please sign in to comment.