@@ -213,7 +213,7 @@ superagent.Request.prototype.end = function(callback) {
213
213
} ) ;
214
214
} ;
215
215
216
- function enableDataDogTracking ( ) {
216
+ function enableDataDogTracking ( store : AppStore ) {
217
217
datadogLogs . init ( {
218
218
clientToken : 'pub9a94ebb002f105ff44d8e427b6549775' ,
219
219
site : 'datadoghq.com' ,
@@ -246,17 +246,25 @@ function enableDataDogTracking() {
246
246
const oldRequest = ( internalClient as any ) . request ;
247
247
( internalClient as any ) . request = function ( ...args : any ) {
248
248
try {
249
- const url = args [ 1 ] ;
249
+ let url = args [ 1 ] ;
250
+
251
+ if ( Object . keys ( args [ 4 ] ) . length ) {
252
+ url = url + '?' + $ . param ( args [ 4 ] ) ;
253
+ }
254
+
250
255
const data = args [ 2 ] ;
251
256
252
257
const studyIds = data . studyIds || data . studyViewFilter . studyIds ;
253
258
259
+ const appName = store . serverConfig . app_name ;
260
+
254
261
if ( studyIds . length < 4 && _ . some ( match , re => re . test ( url ) ) ) {
255
262
const hash = hashString ( url + JSON . stringify ( toJS ( data ) ) ) ;
256
263
datadogLogs . logger . info ( 'study view request' , {
257
264
url,
258
265
data,
259
266
hash,
267
+ appName,
260
268
} ) ;
261
269
}
262
270
} catch ( ex ) {
@@ -363,10 +371,12 @@ $(document).ready(async () => {
363
371
initializeAppStore ( stores . appStore ) ;
364
372
365
373
if (
366
- stores . appStore . serverConfig . app_name === 'public-portal' &&
374
+ [ 'genie-public-portal' , 'public-portal' ] . includes (
375
+ stores . appStore . serverConfig . app_name !
376
+ ) &&
367
377
! isWebdriver ( )
368
378
) {
369
- enableDataDogTracking ( ) ;
379
+ enableDataDogTracking ( stores . appStore ) ;
370
380
}
371
381
372
382
await loadCustomJs ( ) ;
0 commit comments