Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
import { getGlobalUrl } from './global';
import { request } from './miscellaneous';

import { getLibraryVersion, getDisableSetCookie } from './sdk';
import { getLibraryVersion, getDisableSetCookie, getClientId } from './sdk';

function generateLogPayload(account, { meta, events: bizEvents, tracking }) {
const { deviceID, sessionID, integration_type, messaging_version } = meta.global ?? {};
Expand Down Expand Up @@ -212,3 +212,14 @@ logger.addTrackingBuilder(() => {
timestamp: new Date().getTime()
};
});

logger.addHeaderBuilder(() => {
if (__MESSAGES__.__TARGET__ === 'SDK') {
const encodedClientId = btoa(getClientId());
return {
// Send authorization header with tracking event
authorization: `Basic ${encodedClientId}`
};
}
return null;
});
5 changes: 5 additions & 0 deletions src/utils/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export function getAccount() {
return undefined;
}
}

export function getClientId() {
return getClientID();
}

export function getPageType() {
if (__MESSAGES__.__TARGET__ === 'SDK') {
return getSDKPageType();
Expand Down
Loading