import { useURL } from './useURL' ; import { useDNT } from './useDNT' ; export interface UTMParams { source : string ; } export function useUTMLink ( url , params ) { const urlObj = new URL ( url ) ; if ( ! useDNT ( ) ) { urlObj . searchParams . set ( 'utm_source' , params . source ) ; } return urlObj . toString ( ) ; } export function useUTMPathLink ( url , path = '/' ) { return useUTMLink ( url , { source : useURL ( path ) } ) ; }