Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: impl analytics with hotjar #157

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading