@@ -34,7 +34,11 @@ describe('Integration Capture', () => {
3434 it ( 'should initialize with a filtered list of integration attribute mappings' , ( ) => {
3535 const integrationCapture = new IntegrationCapture ( ) ;
3636 const mappings = integrationCapture . filteredIntegrationAttributeMappings ;
37- expect ( Object . keys ( mappings ) ) . toEqual ( [ 'rtid' , 'RoktTransactionId' ] ) ;
37+ expect ( Object . keys ( mappings ) ) . toEqual ( [
38+ 'rtid' ,
39+ 'rclid' ,
40+ 'RoktTransactionId'
41+ ] ) ;
3842 } ) ;
3943 } ) ;
4044
@@ -80,6 +84,7 @@ describe('Integration Capture', () => {
8084 'gbraid=67890' ,
8185 'wbraid=09876' ,
8286 'rtid=84324' ,
87+ 'rclid=7183717' ,
8388 'ScCid=1234'
8489 ] . join ( '&' ) ;
8590
@@ -102,6 +107,7 @@ describe('Integration Capture', () => {
102107 gclid : '54321' ,
103108 gbraid : '67890' ,
104109 rtid : '84324' ,
110+ rclid : '7183717' ,
105111 wbraid : '09876' ,
106112 ScCid :'1234'
107113 } ) ;
@@ -241,6 +247,20 @@ describe('Integration Capture', () => {
241247 } ) ;
242248 } ) ;
243249
250+ it ( 'should capture rclid via url param' , ( ) => {
251+ const url = new URL ( 'https://www.example.com/?rclid=7183717' ) ;
252+
253+ window . location . href = url . href ;
254+ window . location . search = url . search ;
255+
256+ const integrationCapture = new IntegrationCapture ( ) ;
257+ integrationCapture . capture ( ) ;
258+
259+ expect ( integrationCapture . clickIds ) . toEqual ( {
260+ rclid : '7183717' ,
261+ } ) ;
262+ } ) ;
263+
244264 it ( 'should capture RoktTransactionId via cookies' , ( ) => {
245265 window . document . cookie = 'RoktTransactionId=12345' ;
246266
@@ -293,6 +313,24 @@ describe('Integration Capture', () => {
293313 } ) ;
294314 } ) ;
295315
316+ it ( 'should prioritize rclid over RoktTransactionId via cookies' , ( ) => {
317+ jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => 42 ) ;
318+
319+ const url = new URL ( 'https://www.example.com/?rclid=7183717' ) ;
320+
321+ window . document . cookie = 'RoktTransactionId=12345' ;
322+
323+ window . location . href = url . href ;
324+ window . location . search = url . search ;
325+
326+ const integrationCapture = new IntegrationCapture ( ) ;
327+ integrationCapture . capture ( ) ;
328+
329+ expect ( integrationCapture . clickIds ) . toEqual ( {
330+ rclid : '7183717' ,
331+ } ) ;
332+ } ) ;
333+
296334 it ( 'should prioritize rtid over RoktTransactionId via local storage' , ( ) => {
297335 jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => 42 ) ;
298336
@@ -311,6 +349,24 @@ describe('Integration Capture', () => {
311349 } ) ;
312350 } ) ;
313351
352+ it ( 'should prioritize rclid over RoktTransactionId via local storage' , ( ) => {
353+ jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => 42 ) ;
354+
355+ const url = new URL ( 'https://www.example.com/?rclid=7183717' ) ;
356+
357+ window . location . href = url . href ;
358+ window . location . search = url . search ;
359+
360+ localStorage . setItem ( 'RoktTransactionId' , '12345' ) ;
361+
362+ const integrationCapture = new IntegrationCapture ( ) ;
363+ integrationCapture . capture ( ) ;
364+
365+ expect ( integrationCapture . clickIds ) . toEqual ( {
366+ rclid : '7183717' ,
367+ } ) ;
368+ } ) ;
369+
314370 it ( 'should prioritize local storage over cookies' , ( ) => {
315371 jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => 42 ) ;
316372
@@ -356,7 +412,7 @@ describe('Integration Capture', () => {
356412 jest . spyOn ( Date , 'now' ) . mockImplementation ( ( ) => 42 ) ;
357413
358414 const url = new URL (
359- 'https://www.example.com/?ttclid=12345&fbclid=67890&gclid=54321'
415+ 'https://www.example.com/?ttclid=12345&fbclid=67890&gclid=54321&rclid=7183717&rtid=54321 '
360416 ) ;
361417
362418 window . location . href = url . href ;
@@ -369,6 +425,8 @@ describe('Integration Capture', () => {
369425 fbclid : 'fb.2.42.67890' ,
370426 gclid : '54321' ,
371427 ttclid : '12345' ,
428+ rclid : '7183717' ,
429+ rtid : '54321' ,
372430 } ) ;
373431 } ) ;
374432
0 commit comments