diff --git a/public/app/features/explore/utils/links.test.ts b/public/app/features/explore/utils/links.test.ts index f8bd1fa9e2c..5c1b5938768 100644 --- a/public/app/features/explore/utils/links.test.ts +++ b/public/app/features/explore/utils/links.test.ts @@ -57,15 +57,7 @@ describe('explore links utils', () => { expect(links[0].href).toBe('http://regionalhost'); expect(links[0].title).toBe('external'); - expect(links[0].onClick).toBeDefined(); - - links[0].onClick!({}); - - expect(reportInteraction).toBeCalledWith('grafana_data_link_clicked', { - app: CoreApp.Explore, - internal: false, - origin: DataLinkConfigOrigin.Datasource, - }); + expect(links[0].onClick).not.toBeDefined(); }); it('returns generates title for external link', () => { diff --git a/public/app/features/explore/utils/links.ts b/public/app/features/explore/utils/links.ts index 881fb025b12..a8686e12d68 100644 --- a/public/app/features/explore/utils/links.ts +++ b/public/app/features/explore/utils/links.ts @@ -122,30 +122,6 @@ export const getFieldLinksForExplore = (options: { if (!linkModel.title) { linkModel.title = getTitleFromHref(linkModel.href); } - - // Take over the onClick to report the click, then either call the original onClick or navigate to the URL - // Note: it is likely that an external link that opens in the same tab will not be reported, as the browser redirect might cancel reporting the interaction - const origOnClick = linkModel.onClick; - - linkModel.onClick = (...args) => { - reportInteraction(DATA_LINK_USAGE_KEY, { - origin: link.origin || DataLinkConfigOrigin.Datasource, - app: CoreApp.Explore, - internal: false, - }); - - if (origOnClick) { - origOnClick?.apply(...args); - } else { - // for external links without an onClick, we want to duplicate default href behavior since onClick stops it - if (linkModel.target === '_blank') { - window.open(linkModel.href); - } else { - window.location.href = linkModel.href; - } - } - }; - return linkModel; } else { let internalLinkSpecificVars: ScopedVars = {};