Skip to content

Commit

Permalink
Don't use object destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Nov 21, 2023
1 parent 3ba1e8b commit 7e67d7c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/session-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { _strip_empty_properties } from './utils'

// this might be stored in a cookie with a hard 4096 byte limit, so save characters on key names
export interface SessionSourceProps {
p: string // initial pathname
r: string // referring domain
p?: string // initial pathname
r?: string // referring domain
m?: string // utm medium
s?: string // utm source
c?: string // utm campaign
Expand All @@ -31,17 +31,15 @@ export interface StoredSessionSourceProps {

export const generateSessionSourceParams = (): SessionSourceProps => {
const campaignParams = _info.campaignParams()
return {
return _strip_empty_properties({
p: window?.location.pathname || '',
r: _info.referringDomain(),
..._strip_empty_properties({
m: campaignParams.utm_medium,
s: campaignParams.utm_source,
c: campaignParams.utm_campaign,
n: campaignParams.utm_content,
t: campaignParams.utm_term,
}),
}
m: campaignParams.utm_medium,
s: campaignParams.utm_source,
c: campaignParams.utm_campaign,
n: campaignParams.utm_content,
t: campaignParams.utm_term,
})
}

export class SessionPropsManager {
Expand Down

0 comments on commit 7e67d7c

Please sign in to comment.