Skip to content

Commit

Permalink
modify analytics script addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinwheeler committed Dec 29, 2024
1 parent 3a8a420 commit dc6096a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,26 @@ function App() {

useEffect(() => {
const script = document.createElement("script");
script.id = "GoogleTagManager";
script.type = "text/javascript";
script.src = "https://www.googletagmanager.com/gtag/js?id=G-SS06K698MP";
document.head.appendChild(script);
return () => {
document.head.removeChild(script);
};
}, []);

useEffect(() => {
const script = document.createElement("script");
script.id = "GoogleAnalytics";
script.type = "text/javascript";
script.innerHTML = `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-SS06K698MP');
`;
document.head.appendChild(script);
return () => {
document.head.removeChild(script);
};
Expand Down

0 comments on commit dc6096a

Please sign in to comment.