Skip to content

Commit

Permalink
Fix: Component name on device characteristics event (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Onokaev authored Oct 24, 2022
1 parent 576c198 commit 780aa49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/app/views/query-runner/QueryRunner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ IQueryRunnerState
if (actions) {
actions.runQuery(sampleQuery);
const sanitizedUrl = sanitizeQueryUrl(sampleQuery.sampleUrl);
const deviceCharacteristics = telemetry.getDeviceCharacteristicsData();
telemetry.trackEvent(eventTypes.BUTTON_CLICK_EVENT,
{
ComponentName: componentNames.RUN_QUERY_BUTTON,
SelectedVersion: sampleQuery.selectedVersion,
QuerySignature: `${sampleQuery.selectedVerb} ${sanitizedUrl}`
QuerySignature: `${sampleQuery.selectedVerb} ${sanitizedUrl}`,
...deviceCharacteristics
});

telemetry.trackDeviceCharacteristicsTelemetry();
}
this.setState({ sampleBody: '' });
};
Expand Down
3 changes: 1 addition & 2 deletions src/telemetry/event-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ export const TAB_CLICK_EVENT = 'TAB_CLICK_EVENT';
export const LINK_CLICK_EVENT = 'LINK_CLICK_EVENT';
export const LISTITEM_CLICK_EVENT = 'LISTITEM_CLICK_EVENT';
export const DROPDOWN_CHANGE_EVENT = 'DROPDOWN_CHANGE_EVENT';
export const WINDOW_OPEN_EVENT = 'WINDOW_OPEN_EVENT';
export const DEVICE_CHARACTERISTICS_EVENT = 'DEVICE_CHARACTERISTICS_EVENT';
export const WINDOW_OPEN_EVENT = 'WINDOW_OPEN_EVENT';
16 changes: 6 additions & 10 deletions src/telemetry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { sanitizeQueryUrl } from '../app/utils/query-url-sanitization';
import { IQuery } from '../types/query-runner';
import {
BUTTON_CLICK_EVENT,
DEVICE_CHARACTERISTICS_EVENT,
LINK_CLICK_EVENT,
TAB_CLICK_EVENT,
WINDOW_OPEN_EVENT
Expand Down Expand Up @@ -121,18 +120,15 @@ class Telemetry implements ITelemetry {
telemetry.trackEvent(WINDOW_OPEN_EVENT, properties);
}

public trackDeviceCharacteristicsTelemetry(properties?: any) {
const deviceProperties = {
deviceHeight: screen.height,
deviceWidth: screen.width,
public getDeviceCharacteristicsData() {
return {
deviceHeight: screen.height.toString(),
deviceWidth: screen.width.toString(),
browserScreenSize: getBrowserScreenSize(window.innerWidth),
browserHeight: window.innerHeight,
browserWidth: window.innerWidth,
browserHeight: window.innerHeight.toString(),
browserWidth: window.innerWidth.toString(),
scale: getDeviceScreenScale()
};
properties = Object.assign(properties || {}, deviceProperties);

telemetry.trackEvent(DEVICE_CHARACTERISTICS_EVENT, properties);
}

private getInstrumentationKey() {
Expand Down

0 comments on commit 780aa49

Please sign in to comment.