mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-26 10:14:30 +08:00
feat: santize identity payload and pass source to identity and group calls (#3804)
This commit is contained in:
parent
9bad663c4f
commit
6a8096b8d7
@ -13,6 +13,7 @@ import useLicense, { LICENSE_PLAN_KEY } from 'hooks/useLicense';
|
|||||||
import { NotificationProvider } from 'hooks/useNotifications';
|
import { NotificationProvider } from 'hooks/useNotifications';
|
||||||
import { ResourceProvider } from 'hooks/useResourceAttribute';
|
import { ResourceProvider } from 'hooks/useResourceAttribute';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
|
import { identity, pickBy } from 'lodash-es';
|
||||||
import { DashboardProvider } from 'providers/Dashboard/Dashboard';
|
import { DashboardProvider } from 'providers/Dashboard/Dashboard';
|
||||||
import { QueryBuilderProvider } from 'providers/QueryBuilder';
|
import { QueryBuilderProvider } from 'providers/QueryBuilder';
|
||||||
import { Suspense, useEffect, useState } from 'react';
|
import { Suspense, useEffect, useState } from 'react';
|
||||||
@ -90,13 +91,19 @@ function App(): JSX.Element {
|
|||||||
const orgName =
|
const orgName =
|
||||||
org && Array.isArray(org) && org.length > 0 ? org[0].name : '';
|
org && Array.isArray(org) && org.length > 0 ? org[0].name : '';
|
||||||
|
|
||||||
|
const { name, email } = user;
|
||||||
|
|
||||||
const identifyPayload = {
|
const identifyPayload = {
|
||||||
email: user?.email,
|
email,
|
||||||
name: user?.name,
|
name,
|
||||||
company_name: orgName,
|
company_name: orgName,
|
||||||
role,
|
role,
|
||||||
|
source: 'signoz-ui',
|
||||||
};
|
};
|
||||||
const domain = extractDomain(user?.email);
|
|
||||||
|
const sanitizedIdentifyPayload = pickBy(identifyPayload, identity);
|
||||||
|
|
||||||
|
const domain = extractDomain(email);
|
||||||
|
|
||||||
const hostNameParts = hostname.split('.');
|
const hostNameParts = hostname.split('.');
|
||||||
|
|
||||||
@ -106,13 +113,14 @@ function App(): JSX.Element {
|
|||||||
data_region: hostNameParts[1],
|
data_region: hostNameParts[1],
|
||||||
tenant_url: hostname,
|
tenant_url: hostname,
|
||||||
company_domain: domain,
|
company_domain: domain,
|
||||||
|
source: 'signoz-ui',
|
||||||
};
|
};
|
||||||
|
|
||||||
window.analytics.identify(user?.email, identifyPayload);
|
window.analytics.identify(email, sanitizedIdentifyPayload);
|
||||||
|
|
||||||
window.analytics.group(domain, groupTraits);
|
window.analytics.group(domain, groupTraits);
|
||||||
|
|
||||||
window.clarity('identify', user.email, user.name);
|
window.clarity('identify', email, name);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user