From 82e3be1718eca415961aac5d5d07ef2b0735d05d Mon Sep 17 00:00:00 2001 From: wiem Date: Thu, 21 Dec 2023 13:53:10 +0100 Subject: [PATCH 1/2] rename trackerName to trackerVersion --- COLLECTOR_PARAMS.md | 4 ++-- CONFIGURATION_OPTIONS.md | 6 +++--- src/pixel/state.ts | 2 +- src/types.ts | 4 ++-- test/it/helpers/preambled.ts | 2 +- test/unit/pixel/state.spec.ts | 16 ++++++++-------- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/COLLECTOR_PARAMS.md b/COLLECTOR_PARAMS.md index 4af2fa8e..8203600f 100644 --- a/COLLECTOR_PARAMS.md +++ b/COLLECTOR_PARAMS.md @@ -8,8 +8,8 @@ - contains the b64 url encoded string of the JSON that was sent via `liveConnect.push` function ### `duid` - contains the LiveConnect managed first party identifier, in the `${apexDomainHash}--${ULID}` -### `tna` -- contains the `config.trackerName` +### `tv` +- contains the `config.trackerVersion` ### `pu` - the url on which the event happened, which is populated by the `page` enricher ### `pu_rp` diff --git a/CONFIGURATION_OPTIONS.md b/CONFIGURATION_OPTIONS.md index 36c9ed70..d70649b5 100644 --- a/CONFIGURATION_OPTIONS.md +++ b/CONFIGURATION_OPTIONS.md @@ -137,13 +137,13 @@ Example: identifiersToResolve:["tdid","some-fpc"] } ``` -#### `trackerName` [Optional, HasDefault] -You might want multiple trackerNames on the page, so this can be the used to separate multiple use cases. By default, LC will use the version of this module. +#### `trackerVersion` [Optional, HasDefault] +You might want multiple trackerVersion on the page, so this can be the used to separate multiple use cases. By default, LC will use the version of this module. The default value will be taken from `package.json` if it's not set. Example: ```javascript { - trackerName:"v1.0.1" + trackerVersion:"v2.11.4" } ``` diff --git a/src/pixel/state.ts b/src/pixel/state.ts index 71dde534..40967d64 100644 --- a/src/pixel/state.ts +++ b/src/pixel/state.ts @@ -25,7 +25,7 @@ const paramExtractors: ((state: State) => [string, string][])[] = [ ifDefined('distributorId', did => asStringParam('did', did)), ifDefined('eventSource', source => asParamOrEmpty('se', source, (s) => base64UrlEncode(JSON.stringify(s, replacer)))), ifDefined('liveConnectId', fpc => asStringParam('duid', fpc)), - ifDefined('trackerName', tn => asStringParam('tna', tn)), + ifDefined('trackerVersion', v => asStringParam('tv', v)), state => { if (nonNull(state.pageUrl)) { const [url, isPathRemoved, blockedParams] = collectUrl(state) diff --git a/src/types.ts b/src/types.ts index 766a62ed..c575b9c4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -26,7 +26,7 @@ export interface LiveConnectConfig { gdprConsent?: string expirationDays?: number identifiersToResolve?: string | string[] - trackerName?: string + trackerVersion?: string identityResolutionConfig?: IdentityResolutionConfig distributorId?: string globalVarName?: string @@ -58,7 +58,7 @@ export interface RetrievedIdentifier { export interface State extends LiveConnectConfig { eventSource?: object liveConnectId?: string - trackerName?: string + trackerVersion?: string pageUrl?: string domain?: string hashesFromIdentifiers?: HashedEmail[] diff --git a/test/it/helpers/preambled.ts b/test/it/helpers/preambled.ts index 0b66b585..952e3b64 100644 --- a/test/it/helpers/preambled.ts +++ b/test/it/helpers/preambled.ts @@ -16,7 +16,7 @@ const lc = StandardLiveConnect( customerSpecifics, { // @ts-expect-error - trackerName: LC_VERSION, + trackerVersion: LC_VERSION, contextSelectors: 'p', contextElementsLength: '100' } diff --git a/test/unit/pixel/state.spec.ts b/test/unit/pixel/state.spec.ts index 3265d4c9..9f1e62fd 100644 --- a/test/unit/pixel/state.spec.ts +++ b/test/unit/pixel/state.spec.ts @@ -42,7 +42,7 @@ describe('EventComposition', () => { appId: '9898', eventSource: { eventName: 'viewContent' }, liveConnectId: '213245', - trackerName: 'test tracker', + trackerVersion: 'test tracker', pageUrl: 'https://wwww.example.com?sss', errorDetails: { testError: 'testError' }, retrievedIdentifiers: [{ @@ -68,7 +68,7 @@ describe('EventComposition', () => { 'aid=9898', // appId 'se=eyJldmVudE5hbWUiOiJ2aWV3Q29udGVudCJ9', // base64 of eventSource 'duid=213245', // liveConnectId - 'tna=test%20tracker', // trackerName + 'tv=test%20tracker', // trackerVersion 'pu=https%3A%2F%2Fwwww.example.com%3Fsss', // pageUrl 'ae=eyJ0ZXN0RXJyb3IiOiJ0ZXN0RXJyb3IifQ', // base64 of errorDetails 'ext_sample_cookie=sample_value', // retrievedIdentifiers @@ -94,7 +94,7 @@ describe('EventComposition', () => { appId: '9898', eventSource: { eventName: 'viewContent' }, liveConnectId: '213245', - trackerName: 'test tracker', + trackerVersion: 'test tracker', pageUrl: 'https://wwww.example.com?sss', errorDetails: { testError: 'testError' }, retrievedIdentifiers: [{ @@ -120,7 +120,7 @@ describe('EventComposition', () => { 'aid=9898', // appId 'se=eyJldmVudE5hbWUiOiJ2aWV3Q29udGVudCJ9', // base64 of eventSource 'duid=213245', // liveConnectId - 'tna=test%20tracker', // trackerName + 'tv=test%20tracker', // trackerVersion 'pu=https%3A%2F%2Fwwww.example.com%3Fsss', // pageUrl 'ae=eyJ0ZXN0RXJyb3IiOiJ0ZXN0RXJyb3IifQ', // base64 of errorDetails 'ext_sample_cookie=sample_value', // retrievedIdentifiers @@ -208,11 +208,11 @@ describe('EventComposition', () => { }) it('should send the tracker name', () => { - const trackerName = 'some-name' - const pixelData = { trackerName } + const trackerVersion = 'some-name' + const pixelData = { trackerVersion } const event = new StateWrapper(pixelData) - expect(event.asQuery().toQueryString()).to.eql(`?tna=${trackerName}`) - assert.includeDeepMembers(event.asTuples(), [['tna', trackerName]]) + expect(event.asQuery().toQueryString()).to.eql(`?tv=${trackerVersion}`) + assert.includeDeepMembers(event.asTuples(), [['tv', trackerVersion]]) }) it('should ignore nullable fields', () => { From e27d7a12bade870629f9bbefbe712f107ec0311c Mon Sep 17 00:00:00 2001 From: wiem Date: Thu, 21 Dec 2023 14:18:50 +0100 Subject: [PATCH 2/2] fix test --- test/it/live-connect.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/it/live-connect.spec.ts b/test/it/live-connect.spec.ts index 855f4652..1fce4803 100644 --- a/test/it/live-connect.spec.ts +++ b/test/it/live-connect.spec.ts @@ -93,7 +93,7 @@ describe('LiveConnect', function () { assert.strictEqual(trackingRequests.length, 1) expect(tldCookie).to.eql('.liveintent.com') expect(fpcCookie).to.eql(trackingRequests[0].query.duid) - expect(trackingRequests[0].query.tna).to.eq(`${packageJson.versionPrefix}${packageJson.version}`) + expect(trackingRequests[0].query.tv).to.eq(`${packageJson.versionPrefix}${packageJson.version}`) server.clearHistory() await server.openPage('test.liveintent.com', 'page')