Its instance allows you to deal with UTM parameters
• new UtmSynapse()
▪ Static
Readonly
StorageKey: string
= 'utmParams'
▸ cleanDisplayedUrl(): void
Will ask the browser to remove UTM parameters without reloading the page. Can be useful to avoid users doing copy/paste with UTM parameters
Tip: you should save parameters before doing this (because they would be lost otherwise) Note: if the history browser feature is not accessible it won't work
void
▸ clear(): void
Clear the storage of any UTM parameter
void
▸ load(): null
| Partial
<Record
<UtmParamEnum
, string
>>
Load any UTM parameter in the storage
null
| Partial
<Record
<UtmParamEnum
, string
>>
▸ parse(url?
): null
| Partial
<Record
<UtmParamEnum
, string
>>
Extract UTM parameters from a URL or by default window.location.href
Name | Type |
---|---|
url? |
string |
null
| Partial
<Record
<UtmParamEnum
, string
>>
▸ save(params
): void
Save UTM parameters for later usage
Name | Type |
---|---|
params |
Partial <Record <UtmParamEnum , string >> |
void
▸ setIntoUrl(url
, params
): string
Will add provided parameters to the URL
Note: in case the URL already contains one of those parameters already, we remove all the original ones before patching (to not mix different analytics sessions)
Name | Type |
---|---|
url |
string |
params |
Partial <Record <UtmParamEnum , string >> |
string
▸ trimUrl(url
): string
Remove UTM parameters from an URL
Name | Type |
---|---|
url |
string |
string