mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasources: Add optional tracking for datasources list viewed (#62949)
chore: add optional tracking for datasources list viewed
This commit is contained in:
parent
64c2032c2b
commit
fc6a4eee61
@ -1,5 +1,5 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
import { DataSourceSettings, GrafanaTheme2 } from '@grafana/data';
|
||||
@ -11,7 +11,7 @@ import { contextSrv } from 'app/core/core';
|
||||
import { StoreState, AccessControlAction, useSelector } from 'app/types';
|
||||
|
||||
import { getDataSources, getDataSourcesCount, useDataSourcesRoutes, useLoadDataSources } from '../state';
|
||||
import { trackCreateDashboardClicked, trackExploreClicked } from '../tracking';
|
||||
import { trackCreateDashboardClicked, trackExploreClicked, trackDataSourcesListViewed } from '../tracking';
|
||||
import { constructDataSourceExploreUrl } from '../utils';
|
||||
|
||||
import { DataSourcesListHeader } from './DataSourcesListHeader';
|
||||
@ -59,6 +59,13 @@ export function DataSourcesListView({
|
||||
const dataSourcesRoutes = useDataSourcesRoutes();
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
trackDataSourcesListViewed({
|
||||
grafana_version: config.buildInfo.version,
|
||||
path: location.pathname,
|
||||
});
|
||||
}, [location]);
|
||||
|
||||
if (isLoading) {
|
||||
return <PageLoader />;
|
||||
}
|
||||
|
@ -74,3 +74,7 @@ export const trackExploreClicked = (props: DataSourceGeneralTrackingProps) => {
|
||||
export const trackCreateDashboardClicked = (props: DataSourceGeneralTrackingProps) => {
|
||||
reportInteraction('grafana_ds_create_dashboard_clicked', props);
|
||||
};
|
||||
|
||||
export const trackDataSourcesListViewed = (props: { grafana_version?: string; path?: string }) => {
|
||||
reportInteraction('grafana_ds_datasources_list_viewed', props);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user