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

Commit

Permalink
CM-971: Rename trackerName to trackerVersion (#289)
Browse files Browse the repository at this point in the history
* rename trackerName to trackerVersion

* fix test
  • Loading branch information
wi101 authored Jan 8, 2024
1 parent 8f066f2 commit 38a8637
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions COLLECTOR_PARAMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
6 changes: 3 additions & 3 deletions CONFIGURATION_OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/pixel/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface LiveConnectConfig {
gdprConsent?: string
expirationDays?: number
identifiersToResolve?: string | string[]
trackerName?: string
trackerVersion?: string
identityResolutionConfig?: IdentityResolutionConfig
distributorId?: string
globalVarName?: string
Expand Down Expand Up @@ -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[]
Expand Down
2 changes: 1 addition & 1 deletion test/it/helpers/preambled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const lc = StandardLiveConnect(
customerSpecifics,
{
// @ts-expect-error
trackerName: LC_VERSION,
trackerVersion: LC_VERSION,
contextSelectors: 'p',
contextElementsLength: '100'
}
Expand Down
2 changes: 1 addition & 1 deletion test/it/live-connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
16 changes: 8 additions & 8 deletions test/unit/pixel/state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand All @@ -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
Expand All @@ -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: [{
Expand All @@ -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
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 38a8637

Please sign in to comment.