Skip to content

Commit

Permalink
EPMRPP-87583 || Add additional params to ga4 events
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzmitry Kosarau authored and Dzmitry Kosarau committed Nov 13, 2023
1 parent bc8a5a5 commit f3cf3d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { normalizeEventString } from '../../utils';
import { LAUNCH_ANALYZE_TYPES_TO_ANALYTICS_TITLES_MAP } from '../common/constants';
import { getBasicClickEventParameters } from '../common/ga4Utils';
import { getBasicClickEventParameters, normalizeEventParameter } from '../common/ga4Utils';

const PROJECT_SETTINGS = 'project_settings';
const ANALYZER = 'analyzer';
Expand Down Expand Up @@ -183,10 +183,11 @@ export const PROJECT_SETTINGS_DEFECT_TYPES_EVENTS = {
};

export const PROJECT_SETTINGS_INTEGRATION = {
clickDocumentationLink: (place) => ({
clickDocumentationLink: (place, type) => ({
...BASIC_EVENT_PARAMETERS_INTEGRATIONS,
place: normalizeEventString(place),
link_name: 'documentation',
...(type && { type: normalizeEventParameter(type) }),
}),

CLICK_ADD_PROJECT_INTEGRATION: (type) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ export const IntegrationHeader = (props) => {
} = props;

const { documentationLink = '' } = details;
const analyticsData = withButton ? 'integrations' : 'no_integrations';

const handleDocumentationClick = () => {
trackEvent(PROJECT_SETTINGS_INTEGRATION.clickDocumentationLink('integrations'));
trackEvent(PROJECT_SETTINGS_INTEGRATION.clickDocumentationLink(analyticsData, name));
};

const integrationDescription = PLUGIN_DESCRIPTIONS_MAP[name] ? (
Expand All @@ -60,7 +61,7 @@ export const IntegrationHeader = (props) => {
content={formatMessage(messages.linkToDocumentation, {
a: (link) => createExternalLink(link, documentationLink),
})}
event={PROJECT_SETTINGS_INTEGRATION.clickDocumentationLink('integrations')}
event={PROJECT_SETTINGS_INTEGRATION.clickDocumentationLink(analyticsData, name)}
/>
</>
) : (
Expand Down

0 comments on commit f3cf3d0

Please sign in to comment.