Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
NOISSUE - Log cookie domain (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
3link authored Dec 18, 2023
1 parent 8e38477 commit 7a3f4f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pixel/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const paramExtractors: ((state: State) => [string, string][])[] = [
ifDefined('referrer', referrer => asStringParam('refr', referrer)),
ifDefined('contextElements', contextElements => asStringParam('c', contextElements)),
ifDefined('gppString', gppString => asStringParam('gpp_s', gppString)),
ifDefined('gppApplicableSections', gppApplicableSections => asStringParamTransform('gpp_as', gppApplicableSections, (gppAs) => gppAs.join(',')))
ifDefined('gppApplicableSections', gppApplicableSections => asStringParamTransform('gpp_as', gppApplicableSections, (gppAs) => gppAs.join(','))),
ifDefined('cookieDomain', d => asStringParam('cd', d))
]

export class Query {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export interface State extends LiveConnectConfig {
contextElements?: string
privacyMode?: boolean
referrer?: string
cookieDomain?: string
}

export interface HemStore {
Expand Down
9 changes: 9 additions & 0 deletions test/unit/standard-live-connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ describe('StandardLiveConnect', () => {
expect(params.e).to.eql(`${hashes.md5},${hashes.sha1},${hashes.sha256}`)
})

it('send the cookie domain', () => {
storage.setCookie('_li_dcdm_c', '.example.com')
const lc = StandardLiveConnect({}, storage, calls)
lc.fire()
expect(pixelCalls.length).to.eql(1)
const params = urlParams(pixelCalls[0].url)
expect(params.cd).to.eql('.example.com')
})

it('send an empty event when fired', () => {
const lc = StandardLiveConnect({}, storage, calls)
lc.fire()
Expand Down

0 comments on commit 7a3f4f7

Please sign in to comment.