feat: integrate Microsoft Clarity for enhanced user analytics and add necessary configurations

This commit is contained in:
Your Name
2026-03-23 01:28:14 +02:00
parent 5310493cac
commit 20c15e333c
5 changed files with 91 additions and 74 deletions

View File

@@ -79,3 +79,5 @@ VITE_ADSENSE_SLOT_BOTTOM_BANNER=1234567893
FEATURE_EDITOR=true FEATURE_EDITOR=true
FEATURE_OCR=true FEATURE_OCR=true
FEATURE_REMOVEBG=true FEATURE_REMOVEBG=true
VITE_CLARITY_PROJECT_ID=vzw2jb2ipq

View File

@@ -1,22 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" dir="ltr"> <html lang="en" dir="ltr">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" <meta name="description" content="Free online tools for PDF, image, video, and text processing. Merge, split, compress, convert, watermark, protect & more — instantly." />
content="Free online tools for PDF, image, video, and text processing. Merge, split, compress, convert, watermark, protect & more — instantly." />
<meta name="google-site-verification" content="tx9YptvPfrvb115PeFBWpYpRhw_4CYHQXzpLKNXXV20" /> <meta name="google-site-verification" content="tx9YptvPfrvb115PeFBWpYpRhw_4CYHQXzpLKNXXV20" />
<meta name="msvalidate.01" content="65E1161EF971CA2810FE8EABB5F229B4" /> <meta name="msvalidate.01" content="65E1161EF971CA2810FE8EABB5F229B4" />
<meta name="keywords" <meta name="keywords" content="PDF tools, merge PDF, split PDF, compress PDF, PDF to Word, image converter, free online tools, Arabic PDF tools" />
content="PDF tools, merge PDF, split PDF, compress PDF, PDF to Word, image converter, free online tools, Arabic PDF tools" />
<meta name="author" content="Dociva" /> <meta name="author" content="Dociva" />
<meta name="robots" content="index, follow" /> <meta name="robots" content="index, follow" />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="Dociva — Free Online File Tools" /> <meta property="og:title" content="Dociva — Free Online File Tools" />
<meta property="og:description" <meta property="og:description" content="30+ free tools: merge, split, compress, convert PDFs, images, videos & text. No signup required." />
content="30+ free tools: merge, split, compress, convert PDFs, images, videos & text. No signup required." />
<meta property="og:site_name" content="Dociva" /> <meta property="og:site_name" content="Dociva" />
<meta property="og:image" content="/social-preview.svg" /> <meta property="og:image" content="/social-preview.svg" />
<meta property="og:image:alt" content="Dociva social preview" /> <meta property="og:image:alt" content="Dociva social preview" />
@@ -25,17 +21,9 @@
<meta property="og:locale:alternate" content="fr_FR" /> <meta property="og:locale:alternate" content="fr_FR" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Dociva — Free Online File Tools" /> <meta name="twitter:title" content="Dociva — Free Online File Tools" />
<meta name="twitter:description" <meta name="twitter:description" content="30+ free tools: merge, split, compress, convert PDFs, images, videos & text. No signup required." />
content="30+ free tools: merge, split, compress, convert PDFs, images, videos & text. No signup required." />
<meta name="twitter:image" content="/social-preview.svg" /> <meta name="twitter:image" content="/social-preview.svg" />
<meta name="twitter:image:alt" content="Dociva social preview" /> <meta name="twitter:image:alt" content="Dociva social preview" />
<script type="text/javascript">
(function (c, l, a, r, i, t, y) {
c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };
t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/" + i;
y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "vzw2jb2ipq");
</script>
<script> <script>
(function () { (function () {
try { try {
@@ -62,17 +50,12 @@
<link rel="dns-prefetch" href="https://fonts.gstatic.com" /> <link rel="dns-prefetch" href="https://fonts.gstatic.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="preload" as="style" <link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap" />
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap" /> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet" />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap"
rel="stylesheet" />
<title>Dociva — Free Online File Tools</title> <title>Dociva — Free Online File Tools</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
</body> </body>
</html> </html>

View File

@@ -1,4 +1,5 @@
import { lazy, Suspense, useEffect } from 'react'; import { lazy, Suspense, useEffect } from 'react';
import Clarity from '@microsoft/clarity';
import { Routes, Route, useLocation } from 'react-router-dom'; import { Routes, Route, useLocation } from 'react-router-dom';
import { Toaster } from 'sonner'; import { Toaster } from 'sonner';
import Header from '@/components/layout/Header'; import Header from '@/components/layout/Header';
@@ -95,6 +96,14 @@ export default function App() {
void refreshUser(); void refreshUser();
}, [refreshUser]); }, [refreshUser]);
// Microsoft Clarity: Run only in production and browser
useEffect(() => {
if (import.meta.env.PROD && typeof window !== 'undefined') {
// ضع هنا رقم مشروع Clarity الخاص بك بدلاً من 'YOUR_CLARITY_PROJECT_ID'
Clarity.start(import.meta.env.VITE_CLARITY_PROJECT_ID);
}
}, []);
useEffect(() => { useEffect(() => {
trackPageView(`${location.pathname}${location.search}`); trackPageView(`${location.pathname}${location.search}`);
}, [location.pathname, location.search]); }, [location.pathname, location.search]);

18
package-lock.json generated Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "SaaS-PDF",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@microsoft/clarity": "^1.0.2"
}
},
"node_modules/@microsoft/clarity": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@microsoft/clarity/-/clarity-1.0.2.tgz",
"integrity": "sha512-9EZYROFpJxEGmQpHvUFqvD3ZJ7QQSqnibYSWmS+1xusoZfG1QQ1/Al9yVBBc11DWMbJrs1pe1hLT273it/skJg==",
"license": "MIT"
}
}
}

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"@microsoft/clarity": "^1.0.2"
}
}