This repository was archived by the owner on Feb 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,12 +8,18 @@ const findInSearch = (exp: RegExp): string | undefined => {
88 return ( res && res [ 2 ] ) || undefined
99}
1010
11- const utmSourceRegex = / [ ? & ] ( r e f | s o u r c e | u t m _ s o u r c e ) = ( [ ^ ? & ] + ) /
12- const utmCampaignRegex = / [ ? & ] ( u t m _ c a m p a i g n ) = ( [ ^ ? & ] + ) /
11+ const utmSourceRegex = / [ ? & ] ( r e f | s o u r c e | u t m _ s o u r c e | g a d _ s o u r c e ) = ( [ ^ ? & ] + ) /
12+ const utmCampaignRegex = / [ ? & ] ( u t m _ c a m p a i g n | g a d _ c a m p a i g n i d ) = ( [ ^ ? & ] + ) /
1313const utmMediumRegex = / [ ? & ] ( u t m _ m e d i u m ) = ( [ ^ ? & ] + ) /
1414const utmTermRegex = / [ ? & ] ( u t m _ t e r m ) = ( [ ^ ? & ] + ) /
1515const utmContentRegex = / [ ? & ] ( u t m _ c o n t e n t ) = ( [ ^ ? & ] + ) /
1616
17+ const gclidRegex = / [ ? & ] ( g c l i d ) = ( [ ^ ? & ] + ) /
18+
19+ const getGclid = ( ) => {
20+ return findInSearch ( gclidRegex ) ? '<gclid>' : undefined
21+ }
22+
1723export const isInBrowser = ( ) => {
1824 return typeof window !== 'undefined'
1925}
@@ -44,7 +50,7 @@ export const getReferrer = (): string | undefined => {
4450
4551export const getUTMSource = ( ) => findInSearch ( utmSourceRegex )
4652
47- export const getUTMMedium = ( ) => findInSearch ( utmMediumRegex )
53+ export const getUTMMedium = ( ) => findInSearch ( utmMediumRegex ) || getGclid ( )
4854
4955export const getUTMCampaign = ( ) => findInSearch ( utmCampaignRegex )
5056
You can’t perform that action at this time.
0 commit comments