Skip to content

Commit

Permalink
Merge pull request #157 from horuslabsio/impl-analytics
Browse files Browse the repository at this point in the history
feat: impl analytics with hotjar
  • Loading branch information
Darlington02 authored Nov 28, 2024
2 parents 1b14a25 + 99c4467 commit 6c798d8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions frontend/src/app/components/internal/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";
import Script from "next/script";

const Analytics = () => {
return (
<Script
id="hotjar"
strategy="beforeInteractive"
dangerouslySetInnerHTML={{
__html: `
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:5222700,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
`,
}}
></Script>
);
};

export { Analytics };
2 changes: 2 additions & 0 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata } from "next";
import "./globals.css";
import { StarknetProvider } from "~/StarknetProvider";
import Footer from "./components/internal/Footer";
import { Analytics } from "./components/internal/Analytics";

export const metadata: Metadata = {
title: "Starknet Scaffold",
Expand Down Expand Up @@ -31,6 +32,7 @@ export default function RootLayout({
<body className="font-coolvetica text-sm text-text-primary md:text-md">
<StarknetProvider>{children}</StarknetProvider>
<Footer />
<Analytics />
</body>
</html>
);
Expand Down

0 comments on commit 6c798d8

Please sign in to comment.