mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-09 16:03:31 +00:00
feat(tracking) Add tracking events to our chrome extension page (#7967)
This commit is contained in:
parent
8019d17aa6
commit
abeda11ba1
@ -64,6 +64,8 @@ export enum EventType {
|
|||||||
SelectAutoCompleteOption,
|
SelectAutoCompleteOption,
|
||||||
SelectQuickFilterEvent,
|
SelectQuickFilterEvent,
|
||||||
DeselectQuickFilterEvent,
|
DeselectQuickFilterEvent,
|
||||||
|
EmbedProfileViewEvent,
|
||||||
|
EmbedProfileViewInDataHubEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -495,6 +497,18 @@ export interface DeselectQuickFilterEvent extends BaseEvent {
|
|||||||
quickFilterValue: string;
|
quickFilterValue: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface EmbedProfileViewEvent extends BaseEvent {
|
||||||
|
type: EventType.EmbedProfileViewEvent;
|
||||||
|
entityType: string;
|
||||||
|
entityUrn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EmbedProfileViewInDataHubEvent extends BaseEvent {
|
||||||
|
type: EventType.EmbedProfileViewInDataHubEvent;
|
||||||
|
entityType: string;
|
||||||
|
entityUrn: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event consisting of a union of specific event types.
|
* Event consisting of a union of specific event types.
|
||||||
*/
|
*/
|
||||||
@ -557,4 +571,6 @@ export type Event =
|
|||||||
| DeleteQueryEvent
|
| DeleteQueryEvent
|
||||||
| SelectAutoCompleteOption
|
| SelectAutoCompleteOption
|
||||||
| SelectQuickFilterEvent
|
| SelectQuickFilterEvent
|
||||||
| DeselectQuickFilterEvent;
|
| DeselectQuickFilterEvent
|
||||||
|
| EmbedProfileViewEvent
|
||||||
|
| EmbedProfileViewInDataHubEvent;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useParams } from 'react-router';
|
import { useParams } from 'react-router';
|
||||||
import styled from 'styled-components/macro';
|
import styled from 'styled-components/macro';
|
||||||
import { useGetGrantedPrivilegesQuery } from '../../graphql/policy.generated';
|
import { useGetGrantedPrivilegesQuery } from '../../graphql/policy.generated';
|
||||||
@ -9,6 +9,8 @@ import { decodeUrn } from '../entity/shared/utils';
|
|||||||
import CompactContext from '../shared/CompactContext';
|
import CompactContext from '../shared/CompactContext';
|
||||||
import { useEntityRegistry } from '../useEntityRegistry';
|
import { useEntityRegistry } from '../useEntityRegistry';
|
||||||
import { useGetAuthenticatedUserUrn } from '../useGetAuthenticatedUser';
|
import { useGetAuthenticatedUserUrn } from '../useGetAuthenticatedUser';
|
||||||
|
import analytics from '../analytics/analytics';
|
||||||
|
import { EventType } from '../analytics';
|
||||||
|
|
||||||
const EmbeddedPageWrapper = styled.div`
|
const EmbeddedPageWrapper = styled.div`
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
@ -29,6 +31,14 @@ export default function EmbeddedPage({ entityType }: Props) {
|
|||||||
const { urn: encodedUrn } = useParams<RouteParams>();
|
const { urn: encodedUrn } = useParams<RouteParams>();
|
||||||
const urn = decodeUrn(encodedUrn);
|
const urn = decodeUrn(encodedUrn);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
analytics.event({
|
||||||
|
type: EventType.EmbedProfileViewEvent,
|
||||||
|
entityType,
|
||||||
|
entityUrn: urn,
|
||||||
|
});
|
||||||
|
}, [entityType, urn]);
|
||||||
|
|
||||||
const authenticatedUserUrn = useGetAuthenticatedUserUrn();
|
const authenticatedUserUrn = useGetAuthenticatedUserUrn();
|
||||||
const { data } = useGetGrantedPrivilegesQuery({
|
const { data } = useGetGrantedPrivilegesQuery({
|
||||||
variables: {
|
variables: {
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import { IconStyleType } from '../../Entity';
|
|||||||
import { useEntityData } from '../EntityContext';
|
import { useEntityData } from '../EntityContext';
|
||||||
import { getDisplayedEntityType } from '../containers/profile/header/PlatformContent/PlatformContentContainer';
|
import { getDisplayedEntityType } from '../containers/profile/header/PlatformContent/PlatformContentContainer';
|
||||||
import { ANTD_GRAY } from '../constants';
|
import { ANTD_GRAY } from '../constants';
|
||||||
|
import analytics from '../../../analytics/analytics';
|
||||||
|
import { EventType } from '../../../analytics';
|
||||||
|
|
||||||
const HeaderWrapper = styled.div`
|
const HeaderWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -61,6 +63,14 @@ export default function EmbeddedHeader() {
|
|||||||
const appConfig = useAppConfig();
|
const appConfig = useAppConfig();
|
||||||
const themeConfig = useTheme();
|
const themeConfig = useTheme();
|
||||||
|
|
||||||
|
function trackClickViewInDataHub() {
|
||||||
|
analytics.event({
|
||||||
|
type: EventType.EmbedProfileViewInDataHubEvent,
|
||||||
|
entityType,
|
||||||
|
entityUrn: entityData?.urn || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const typeIcon = entityRegistry.getIcon(entityType, 12, IconStyleType.ACCENT, ANTD_GRAY[8]);
|
const typeIcon = entityRegistry.getIcon(entityType, 12, IconStyleType.ACCENT, ANTD_GRAY[8]);
|
||||||
const displayedEntityType = getDisplayedEntityType(entityData, entityRegistry, entityType);
|
const displayedEntityType = getDisplayedEntityType(entityData, entityRegistry, entityType);
|
||||||
const entityName = entityRegistry.getDisplayName(entityType, entityData);
|
const entityName = entityRegistry.getDisplayName(entityType, entityData);
|
||||||
@ -86,6 +96,7 @@ export default function EmbeddedHeader() {
|
|||||||
href={`${window.location.origin}/${entityTypePathName}/${entityData?.urn}`}
|
href={`${window.location.origin}/${entityTypePathName}/${entityData?.urn}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
|
onClick={trackClickViewInDataHub}
|
||||||
>
|
>
|
||||||
view in DataHub <ArrowRightOutlined />
|
view in DataHub <ArrowRightOutlined />
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
|
|||||||
@ -63,7 +63,9 @@ public enum DataHubUsageEventType {
|
|||||||
UPDATE_QUERY_EVENT("UpdateQueryEvent"),
|
UPDATE_QUERY_EVENT("UpdateQueryEvent"),
|
||||||
SELECT_AUTO_COMPLETE_OPTION("SelectAutoCompleteOption"),
|
SELECT_AUTO_COMPLETE_OPTION("SelectAutoCompleteOption"),
|
||||||
SELECT_QUICK_FILTER_EVENT("SelectQuickFilterEvent"),
|
SELECT_QUICK_FILTER_EVENT("SelectQuickFilterEvent"),
|
||||||
DESELECT_QUICK_FILTER_EVENT("DeselectQuickFilterEvent");
|
DESELECT_QUICK_FILTER_EVENT("DeselectQuickFilterEvent"),
|
||||||
|
EMBED_PROFILE_VIEW_EVENT("EmbedProfileViewEvent"),
|
||||||
|
EMBED_PROFILE_VIEW_IN_DATAHUB_EVENT("EmbedProfileViewInDataHubEvent");
|
||||||
|
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user