Skip to content

Commit

Permalink
fix react-scroll declarartion
Browse files Browse the repository at this point in the history
  • Loading branch information
trishanu-init committed Jul 6, 2024
1 parent ac5851d commit 00d579a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .env → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ NEXT_PUBLIC_API_URL=https://indiekart-admin.vercel.app/api/API_KEY_COPIED_FROM_A
AUTH_SECRET=

AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
AUTH_GITHUB_SECRET=
#Google Analytics Measurement ID
NEXT_PUBLIC_MEASUREMENT_ID=
28 changes: 28 additions & 0 deletions components/GoogleAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// GoogleAnalytics.tsx

import React from 'react';
import Script from 'next/script';

const GoogleAnalytics = () => {
return (
<>
<Script
strategy='lazyOnload'
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_MEASUREMENT_ID}`}
/>

<Script id='' strategy='lazyOnload'>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_MEASUREMENT_ID}', {
page_path: window.location.pathname,
});
`}
</Script>
</>
);
};

export default GoogleAnalytics;
11 changes: 11 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 @@ -57,6 +57,7 @@
"@types/next": "^9.0.0",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-scroll": "^1.8.10",
"typescript": "^5.5.2"
},
"description": "![Copy of Copy of Fullstack Twitter Clone (1)](https://github.com/AntonioErdeljac/next13-ecommerce-admin/assets/23248726/088760cb-837d-44b7-a959-63089385d0a0)",
Expand Down

0 comments on commit 00d579a

Please sign in to comment.