mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
feat(editor): Send template id as string in all telemetry events (#8498)
This commit is contained in:
parent
839dd96c7d
commit
2aed788dc3
|
@ -69,6 +69,7 @@ import { getCredentialTypeName, isCredentialOnlyNodeType } from '@/utils/credent
|
|||
import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useCanvasStore } from '@/stores/canvas.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
|
||||
export function getParentMainInputNode(workflow: Workflow, node: INode): INode {
|
||||
const nodeType = useNodeTypesStore().getNodeType(node.type);
|
||||
|
@ -1094,7 +1095,7 @@ export const workflowHelpers = defineComponent({
|
|||
const templateId = this.$route.query.templateId;
|
||||
if (templateId) {
|
||||
this.$telemetry.track('User saved new workflow from template', {
|
||||
template_id: isNaN(+templateId) ? templateId : +templateId,
|
||||
template_id: tryToParseNumber(String(templateId)),
|
||||
workflow_id: workflowData.id,
|
||||
wf_template_repo_session_id: this.templatesStore.previousSessionId,
|
||||
});
|
||||
|
|
|
@ -18,6 +18,7 @@ import { useTelemetry } from '@/composables/useTelemetry';
|
|||
import { middleware } from '@/rbac/middleware';
|
||||
import type { RouteConfig, RouterMiddleware } from '@/types/router';
|
||||
import { initializeCore } from '@/init';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
|
||||
const ChangePasswordView = async () => await import('./views/ChangePasswordView.vue');
|
||||
const ErrorView = async () => await import('./views/ErrorView.vue');
|
||||
|
@ -120,7 +121,9 @@ export const routes = [
|
|||
getProperties(route: RouteLocation) {
|
||||
const templatesStore = useTemplatesStore();
|
||||
return {
|
||||
template_id: route.params.id,
|
||||
template_id: tryToParseNumber(
|
||||
Array.isArray(route.params.id) ? route.params.id[0] : route.params.id,
|
||||
),
|
||||
wf_template_repo_session_id: templatesStore.currentSessionId,
|
||||
};
|
||||
},
|
||||
|
@ -142,7 +145,9 @@ export const routes = [
|
|||
getProperties(route: RouteLocation) {
|
||||
const templatesStore = useTemplatesStore();
|
||||
return {
|
||||
template_id: route.params.id,
|
||||
template_id: tryToParseNumber(
|
||||
Array.isArray(route.params.id) ? route.params.id[0] : route.params.id,
|
||||
),
|
||||
wf_template_repo_session_id: templatesStore.currentSessionId,
|
||||
};
|
||||
},
|
||||
|
|
|
@ -21,6 +21,7 @@ import type { Telemetry } from '@/plugins/telemetry';
|
|||
import type { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { assert } from '@/utils/assert';
|
||||
import { doesNodeHaveCredentialsToFill } from '@/utils/nodes/nodeTransforms';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
|
||||
type ExternalHooks = ReturnType<typeof useExternalHooks>;
|
||||
|
||||
|
@ -106,7 +107,7 @@ async function openTemplateWorkflowOnNodeView(opts: {
|
|||
};
|
||||
const telemetryPayload = {
|
||||
source: 'workflow',
|
||||
template_id: templateId,
|
||||
template_id: tryToParseNumber(templateId),
|
||||
wf_template_repo_session_id: templatesStore.currentSessionId,
|
||||
};
|
||||
|
||||
|
|
|
@ -156,3 +156,12 @@ export const isValidDate = (input: string | number | Date): boolean => {
|
|||
|
||||
export const getObjectKeys = <T extends object, K extends keyof T>(o: T): K[] =>
|
||||
Object.keys(o) as K[];
|
||||
|
||||
/**
|
||||
* Converts a string to a number if possible. If not it returns the original string.
|
||||
* For a string to be converted to a number it has to contain only digits.
|
||||
* @param value The value to convert to a number
|
||||
*/
|
||||
export const tryToParseNumber = (value: string): number | string => {
|
||||
return isNaN(+value) ? value : +value;
|
||||
};
|
||||
|
|
|
@ -378,6 +378,7 @@ import { useSourceControlStore } from '@/stores/sourceControl.store';
|
|||
import { useDeviceSupport } from 'n8n-design-system';
|
||||
import { useDebounce } from '@/composables/useDebounce';
|
||||
import { useCanvasPanning } from '@/composables/useCanvasPanning';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
|
||||
interface AddNodeOptions {
|
||||
position?: XYPosition;
|
||||
|
@ -1327,7 +1328,7 @@ export default defineComponent({
|
|||
'User inserted workflow template',
|
||||
{
|
||||
source: 'workflow',
|
||||
template_id: templateId,
|
||||
template_id: tryToParseNumber(templateId),
|
||||
wf_template_repo_session_id: this.templatesStore.previousSessionId,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ import { createWorkflowFromTemplate } from '@/utils/templates/templateActions';
|
|||
import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useTelemetry } from '@/composables/useTelemetry';
|
||||
import { useCredentialSetupState } from '@/views/SetupWorkflowFromTemplateView/useCredentialSetupState';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
|
||||
export type NodeAndType = {
|
||||
node: INodeUi;
|
||||
|
@ -200,14 +201,14 @@ export const useSetupTemplateStore = defineStore('setupTemplate', () => {
|
|||
'User inserted workflow template',
|
||||
{
|
||||
source: 'workflow',
|
||||
template_id: templateId.value,
|
||||
template_id: tryToParseNumber(templateId.value),
|
||||
wf_template_repo_session_id: templatesStore.currentSessionId,
|
||||
},
|
||||
{ withPostHog: true },
|
||||
);
|
||||
|
||||
telemetry.track('User saved new workflow from template', {
|
||||
template_id: isNaN(+templateId.value) ? templateId : +templateId.value,
|
||||
template_id: tryToParseNumber(templateId.value),
|
||||
workflow_id: createdWorkflow.id,
|
||||
wf_template_repo_session_id: templatesStore.currentSessionId,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue