Skip to content

Latest commit

 

History

History
186 lines (102 loc) · 3.48 KB

UtmSynapse.md

File metadata and controls

186 lines (102 loc) · 3.48 KB

Class: UtmSynapse

Its instance allows you to deal with UTM parameters

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new UtmSynapse()

Defined in

index.ts:24

Properties

StorageKey

Static Readonly StorageKey: string = 'utmParams'

Defined in

index.ts:21

Methods

cleanDisplayedUrl

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

Returns

void

Defined in

index.ts:145


clear

clear(): void

Clear the storage of any UTM parameter

Returns

void

Defined in

index.ts:114


load

load(): null | Partial<Record<UtmParamEnum, string>>

Load any UTM parameter in the storage

Returns

null | Partial<Record<UtmParamEnum, string>>

Defined in

index.ts:103


parse

parse(url?): null | Partial<Record<UtmParamEnum, string>>

Extract UTM parameters from a URL or by default window.location.href

Parameters

Name Type
url? string

Returns

null | Partial<Record<UtmParamEnum, string>>

Defined in

index.ts:38


save

save(params): void

Save UTM parameters for later usage

Parameters

Name Type
params Partial<Record<UtmParamEnum, string>>

Returns

void

Defined in

index.ts:60


setIntoUrl

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)

Parameters

Name Type
url string
params Partial<Record<UtmParamEnum, string>>

Returns

string

Defined in

index.ts:161


trimUrl

trimUrl(url): string

Remove UTM parameters from an URL

Parameters

Name Type
url string

Returns

string

Defined in

index.ts:123