diff --git a/packages/core/admin/admin/src/pages/App/index.js b/packages/core/admin/admin/src/pages/App/index.js
index fc25e76844..cd2cb5194b 100644
--- a/packages/core/admin/admin/src/pages/App/index.js
+++ b/packages/core/admin/admin/src/pages/App/index.js
@@ -30,10 +30,7 @@ const AuthenticatedApp = lazy(() =>
function App() {
const toggleNotification = useNotification();
const { formatMessage } = useIntl();
- const [{ isLoading, hasAdmin, uuid, telemetryDisabled }, setState] = useState({
- isLoading: true,
- hasAdmin: false,
- });
+ const [{ isLoading, hasAdmin, uuid }, setState] = useState({ isLoading: true, hasAdmin: false });
const authRoutes = useMemo(() => {
return makeUniqueRoutes(
@@ -69,32 +66,30 @@ function App() {
const getData = async () => {
try {
const {
- data: { hasAdmin, uuid, telemetryDisabled },
+ data: { hasAdmin, uuid },
} = await request('/admin/init', { method: 'GET' });
- setState({ isLoading: false, hasAdmin, uuid, telemetryDisabled });
+ if (uuid) {
+ try {
+ const deviceId = await getUID();
- if (telemetryDisabled || !uuid) {
- return;
+ fetch('https://analytics.strapi.io/track', {
+ method: 'POST',
+ body: JSON.stringify({
+ event: 'didInitializeAdministration',
+ uuid,
+ deviceId,
+ }),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+ } catch (e) {
+ // Silent.
+ }
}
- try {
- const deviceId = await getUID();
-
- fetch('https://analytics.strapi.io/track', {
- method: 'POST',
- body: JSON.stringify({
- event: 'didInitializeAdministration',
- uuid,
- deviceId,
- }),
- headers: {
- 'Content-Type': 'application/json',
- },
- });
- } catch (e) {
- // Silent.
- }
+ setState({ isLoading: false, hasAdmin, uuid });
} catch (err) {
toggleNotification({
type: 'warning',
@@ -115,7 +110,7 @@ function App() {
return (
}>
{formatMessage({ id: 'skipToContent' })}
-
+
{authRoutes}
{
const trackRef = useRef();
- const { uuid, telemetryDisabled } = useContext(TrackingContext);
+ const uuid = useContext(TrackingContext);
trackRef.current = (event, properties) => {
- if (telemetryDisabled || !uuid) {
- return;
- }
-
- try {
- axios.post('https://analytics.strapi.io/track', {
- event,
- properties: { ...properties, projectType: strapi.projectType },
- uuid,
- });
- } catch (err) {
- // Silent
+ if (uuid) {
+ try {
+ axios.post('https://analytics.strapi.io/track', {
+ event,
+ properties: { ...properties, projectType: strapi.projectType },
+ uuid,
+ });
+ } catch (err) {
+ // Silent
+ }
}
};