diff --git a/src/components/Analytics.astro b/src/components/Analytics.astro new file mode 100644 index 0000000..7b8d0e2 --- /dev/null +++ b/src/components/Analytics.astro @@ -0,0 +1,34 @@ +--- +const gaId = import.meta.env.PUBLIC_GA_ID; +const clarityId = import.meta.env.PUBLIC_CLARITY_ID; + +const isProd = import.meta.env.MODE === "production"; +--- + +{isProd && gaId && ( + <> + + + + + +)} + +{isProd && clarityId && ( + +)} \ No newline at end of file diff --git a/src/constants/tools.ts b/src/constants/tools.ts index 9b62ade..0521f3a 100644 --- a/src/constants/tools.ts +++ b/src/constants/tools.ts @@ -105,7 +105,8 @@ export const tools: Tool[] = [ }, { name: "Number Base Converter", - description: "Convert numbers between Decimal, Binary, Hexadecimal, and Octal in real time.", + description: + "Convert numbers between Decimal, Binary, Hexadecimal, and Octal in real time.", href: "/tools/number-base-converter", icon: ``, }, @@ -265,22 +266,23 @@ export const tools: Tool[] = [ }, { name: "OpenAPI / Swagger Viewer", - description: "Parse and view OpenAPI/Swagger specifications visually in an interactive, clean API documentation viewer.", + description: + "Parse and view OpenAPI/Swagger specifications visually in an interactive, clean API documentation viewer.", href: "/tools/openapi-swagger-viewer", - + icon: ``, }, { - icon: ``, name: "JWT Generator & Validator", - description: "Generate, inspect, decode, and verify JSON Web Tokens directly in your browser.", + description: + "Generate, inspect, decode, and verify JSON Web Tokens directly in your browser.", href: "/tools/jwt-generator-validator", icon: ``, }, { - name: "Bcrypt Generator & Validator", - description: - "Generate bcrypt hashes with configurable salt rounds and validate plaintext against existing hashes. Runs entirely in your browser.", - href: "/tools/bcrypt-generator", - icon: ``, -}, + name: "Bcrypt Generator & Validator", + description: + "Generate bcrypt hashes with configurable salt rounds and validate plaintext against existing hashes. Runs entirely in your browser.", + href: "/tools/bcrypt-generator", + icon: ``, + }, ]; diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 9d8e1be..f8bc4b6 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -3,6 +3,7 @@ import "../styles/global.css"; import { Image } from "astro:assets"; import ThemeToggle from "../components/ThemeToggle"; import Search from "../components/tool/Search"; +import Analytics from "../components/Analytics.astro"; export interface Props { title?: string; @@ -70,6 +71,7 @@ const { document.documentElement.setAttribute('data-theme', theme); })(); +