diff --git a/src/urlUtils.ts b/src/urlUtils.ts index b5840f15..5f694158 100644 --- a/src/urlUtils.ts +++ b/src/urlUtils.ts @@ -1,4 +1,5 @@ import { Region, VisitorHistoryFilter } from './types'; +import { version } from '../package.json'; const euRegionUrl = 'https://eu.api.fpjs.io/'; const apRegionUrl = 'https://ap.api.fpjs.io/'; @@ -6,6 +7,7 @@ const globalRegionUrl = 'https://api.fpjs.io/'; type QueryStringParameters = VisitorHistoryFilter & { api_key?: string; + ii: string; }; export function getVisitorsUrl( @@ -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;