Skip to content

Commit

Permalink
Implement MS Clarity Data Collector
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlongstaff committed Jun 11, 2024
1 parent c5664d2 commit 455ef45
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"react-dom": "^18.2.0",
"react-github-calendar": "^4.0.8",
"react-icons": "^4.12.0",
"react-microsoft-clarity": "^1.2.0",
"react-parallax-tilt": "^1.7.179",
"react-router-dom": "^6.21.1",
"react-scripts": "^5.0.1",
Expand Down
16 changes: 12 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ----- Import the required modules

import React, { useState, useEffect } from "react";
import { useState, useEffect } from "react";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import "bootstrap/dist/css/bootstrap.min.css";
import { clarity } from "react-microsoft-clarity";

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ----- Import the app components

import ScrollToTop from "./components/ScrollToTop"
import ScrollToTop from "./components/ScrollToTop";
import Preloader from "./components/Preloader";
import Navbar from "./components/Navbar";
import Home from "./components/Home/index";
Expand All @@ -22,13 +23,20 @@ import Footer from "./components/Footer";
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ----- Import the app styles

import './styles/index.css';
import "./styles/index.css";
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// ----- Define the App component

function App() {
const [load, upadateLoad] = useState(true);

// -- Initialise Microsoft Clarity
useEffect(() => {
if (process.env.NODE_ENV === "production") {
clarity.init("mqgrxsm7hq");
}
}, []);

// -- Set a timer to remove the preloader after 1.2 seconds
useEffect(() => {
const timer = setTimeout(() => {
Expand All @@ -54,4 +62,4 @@ function App() {
);
}

export default App;
export default App;

0 comments on commit 455ef45

Please sign in to comment.