Skip to content

Commit

Permalink
refactor: added segment constant for component generator
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Dec 21, 2023
1 parent 12ef94b commit b1fa374
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion www/netlify/functions/trackGenerateComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { v4: uuidv4 } = require('uuid');
const Analytics = require('analytics-node');
const { COMPONENT_GENERATED_EVENT } = require('../../segment-events');

const analytics = new Analytics(process.env.SEGMENT_KEY);

Expand All @@ -12,7 +13,7 @@ exports.handler = async function eventHandler(event) {
// dispatch event to Segment
analytics.track({
anonymousId: uuidv4(),
event: 'openedx.paragon.functions.track-generate-component.created',
event: COMPONENT_GENERATED_EVENT,
properties: { componentName },
});

Expand Down
1 change: 1 addition & 0 deletions www/segment-events/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const ICON_COPIED_EVENT = 'openedx.paragon.docs.icons-table.selected-icon
export const LEAVE_FEEDBACK_CLICKED_EVENT = 'openedx.paragon.docs.leave-feedback.clicked';
export const CONTRAST_CHECKER_CLICKED_EVENT = 'openedx.paragon.docs.menu.tools.visit-contrast-checker.clicked';
export const PAGE_EDIT_BTN_CLICKED_EVENT = 'openedx.paragon.docs.page-edit.clicked';
export const COMPONENT_GENERATED_EVENT = 'openedx.paragon.functions.track-generate-component.created';

export const PLAYGROUND_EVENTS = {
LINK_CLICKED: 'openedx.paragon.docs.menu.playground.visit-playground.clicked',
Expand Down
6 changes: 5 additions & 1 deletion www/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import classNames from 'classnames';
import Search from './Search';
import { SettingsContext } from '../context/SettingsContext';
import { THEMES } from '../../theme-config';
import { PLAYGROUND_EVENTS, sendUserAnalyticsEvent, CONTRAST_CHECKER_CLICKED_EVENT } from '../../segment-events';
import {
PLAYGROUND_EVENTS,
sendUserAnalyticsEvent,
CONTRAST_CHECKER_CLICKED_EVENT,
} from '../../segment-events';
import { FOUNDATION_PAGES } from '../config';

// MDX transforms markdown generated by gatsby-transformer-react-docgen
Expand Down

0 comments on commit b1fa374

Please sign in to comment.