@@ -16,6 +16,7 @@ import StatShares from 'calypso/my-sites/stats/features/modules/stats-shares';
16
16
import StatsModuleTags from 'calypso/my-sites/stats/features/modules/stats-tags' ;
17
17
import usePlanUsageQuery from 'calypso/my-sites/stats/hooks/use-plan-usage-query' ;
18
18
import { useShouldGateStats } from 'calypso/my-sites/stats/hooks/use-should-gate-stats' ;
19
+ import { recordCurrentScreen } from 'calypso/my-sites/stats/hooks/use-stats-navigation-history' ;
19
20
import { useSelector } from 'calypso/state' ;
20
21
import { STATS_PLAN_USAGE_RECEIVE } from 'calypso/state/action-types' ;
21
22
import { isJetpackSite } from 'calypso/state/sites/selectors' ;
@@ -29,7 +30,7 @@ import statsStrings from '../../stats-strings';
29
30
import StatsUpsell from '../../stats-upsell/insights-upsell' ;
30
31
import StatsModuleListing from '../shared/stats-module-listing' ;
31
32
32
- function StatsInsights ( ) {
33
+ function StatsInsights ( { context } ) {
33
34
const siteId = useSelector ( ( state ) => getSelectedSiteId ( state ) ) ;
34
35
const siteSlug = useSelector ( ( state ) => getSelectedSiteSlug ( state , siteId ) ) ;
35
36
const isJetpack = useSelector ( ( state ) => isJetpackSite ( state , siteId ) ) ;
@@ -60,6 +61,18 @@ function StatsInsights() {
60
61
[ ]
61
62
) ; // Track the last viewed tab.
62
63
64
+ useEffect ( ( ) => {
65
+ const query = context . query ;
66
+ recordCurrentScreen (
67
+ 'insights' ,
68
+ {
69
+ queryParams : query ,
70
+ period : null ,
71
+ } ,
72
+ true
73
+ ) ;
74
+ } , [ context . query ] ) ;
75
+
63
76
const isWPAdmin = config . isEnabled ( 'is_odyssey' ) ;
64
77
const insightsPageClasses = clsx ( 'stats' , { 'is-odyssey-stats' : isWPAdmin } ) ;
65
78
0 commit comments