sdk changes
This commit is contained in:
15
apps/sdk-api/src/utils/parseReferrer.ts
Normal file
15
apps/sdk-api/src/utils/parseReferrer.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import referrers from '../referrers';
|
||||
|
||||
export function parseReferrer(url?: string) {
|
||||
const { hostname } = new URL(url || '');
|
||||
const match = referrers[hostname];
|
||||
|
||||
console.log('Parsing referrer', url);
|
||||
console.log('Match', match);
|
||||
|
||||
return {
|
||||
name: match?.name ?? '',
|
||||
type: match?.type ?? 'unknown',
|
||||
url: url ?? '',
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user