File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -485,18 +485,20 @@ export class SearchComponent implements OnDestroy, OnInit {
485485 * This method should only be called once and is essentially what SearchTrackingComponent used to do (now removed)
486486 * @private
487487 */
488- private subscribeToRoutingEvents ( ) {
489- this . subs . push (
490- this . router . events . pipe (
491- filter ( ( event ) => event instanceof NavigationStart ) ,
492- map ( ( event : NavigationStart ) => this . getDsoUUIDFromUrl ( event . url ) ) ,
493- hasValueOperator ( ) ,
494- ) . subscribe ( ( uuid ) => {
495- if ( this . resultsRD$ . value . hasSucceeded ) {
496- this . service . trackSearch ( this . searchOptions$ . value , this . resultsRD$ . value . payload as SearchObjects < DSpaceObject > , uuid ) ;
497- }
498- } ) ,
499- ) ;
488+ private subscribeToRoutingEvents ( ) : void {
489+ if ( this . trackStatistics ) {
490+ this . subs . push (
491+ this . router . events . pipe (
492+ filter ( ( event ) => event instanceof NavigationStart ) ,
493+ map ( ( event : NavigationStart ) => this . getDsoUUIDFromUrl ( event . url ) ) ,
494+ hasValueOperator ( ) ,
495+ ) . subscribe ( ( uuid ) => {
496+ if ( this . resultsRD$ . value . hasSucceeded ) {
497+ this . service . trackSearch ( this . searchOptions$ . value , this . resultsRD$ . value . payload as SearchObjects < DSpaceObject > , uuid ) ;
498+ }
499+ } ) ,
500+ ) ;
501+ }
500502 }
501503
502504 /**
You can’t perform that action at this time.
0 commit comments