Skip to content

Commit

Permalink
install google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviogranero committed Apr 24, 2024
1 parent 363ff12 commit 6f4df65
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.0.0
15 changes: 12 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { defineConfig } from 'astro/config';
import { defineConfig } from "astro/config";

// https://astro.build/config
import tailwind from "@astrojs/tailwind";

import partytown from "@astrojs/partytown";

// https://astro.build/config
export default defineConfig({
integrations: [tailwind()],
site: 'https://gdg.londrina.dev',
site: "https://gdg.londrina.dev",
integrations: [
tailwind(),
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
],
});
50 changes: 50 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 @@ -12,6 +12,7 @@
"test": "playwright test"
},
"dependencies": {
"@astrojs/partytown": "^2.1.0",
"@astrojs/tailwind": "^2.1.3",
"astro": "^1.6.12",
"tailwindcss": "^3.2.4"
Expand Down
10 changes: 10 additions & 0 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const { title } = Astro.props;
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script type="text/partytown" async src="https://www.googletagmanager.com/gtag/js?id=G-9JMPSZSYMB"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-9JMPSZSYMB');
</script>

<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
Expand Down

0 comments on commit 6f4df65

Please sign in to comment.