@@ -8,7 +8,7 @@ import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
88import { getGlobalUrl } from './global' ;
99import { request } from './miscellaneous' ;
1010
11- import { getLibraryVersion , getDisableSetCookie } from './sdk' ;
11+ import { getLibraryVersion , getDisableSetCookie , getClientId } from './sdk' ;
1212
1313function generateLogPayload ( account , { meta, events : bizEvents , tracking } ) {
1414 const { deviceID, sessionID, integration_type, messaging_version, globalSessionID } = meta . global ?? { } ;
@@ -174,6 +174,18 @@ export const logger = Logger({
174174 ? `${ url } ?disableSetCookie=true&features=disable-set-cookie`
175175 : url ;
176176
177+ // Send authorization header with tracking event
178+ if ( __MESSAGES__ . __TARGET__ === 'SDK' ) {
179+ const encodedClientId = btoa ( getClientId ( ) ) ;
180+ // eslint-disable-next-line no-param-reassign
181+ headers . Authorization = `Basic ${ encodedClientId } ` ;
182+ }
183+ if ( __MESSAGES__ . __TARGET__ === 'STANDALONE' || __MESSAGES__ . __TARGET__ === 'STANDALONE_MODAL' ) {
184+ const encodedPayerId = btoa ( trimmedMeta [ '1' ] . account ) ;
185+ // eslint-disable-next-line no-param-reassign
186+ headers . Authorization = `Basic ${ encodedPayerId } ` ;
187+ }
188+
177189 return ZalgoPromise . all (
178190 translateLogData ( trimmedLog ) . map ( data => {
179191 return request ( method , urlWithCookieParams , {
0 commit comments