Skip to content

Commit

Permalink
Add partytown package and Google tag to astro.config.mjs and base-lay…
Browse files Browse the repository at this point in the history
…out.astro
  • Loading branch information
dharamveergit committed Feb 24, 2024
1 parent 62334da commit ea5f812
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { defineConfig } from "astro/config";
import remark from "remark-directive";
import { customAsidePlugin } from "./src/lib/aside/customAsidePlugin";
import astroExpressiveCode from "astro-expressive-code";
import partytown from "@astrojs/partytown";

import mdx from "@astrojs/mdx";

Expand Down Expand Up @@ -44,6 +45,11 @@ export default defineConfig({
},
}),
mdx(),
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
],
site: "https://akash.network",
});
29 changes: 29 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 @@ -11,6 +11,7 @@
},
"dependencies": {
"@astrojs/mdx": "^2.0.2",
"@astrojs/partytown": "^2.0.4",
"@astrojs/react": "^3.0.8",
"@astrojs/sitemap": "^3.0.3",
"@astrojs/tailwind": "^5.0.4",
Expand Down
15 changes: 15 additions & 0 deletions src/layouts/base-layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ const isProd = import.meta.env.PROD;
class="scroll-pt-[137px] scroll-smooth"
>
<head>
<!-- Google tag (gtag.js) -->
<script
type="text/partytown"
async
src="https://www.googletagmanager.com/gtag/js?id=G-GL5HS9J1PR"></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-GL5HS9J1PR");
</script>
<BaseHead title={title} description={description} image={image} />
<ViewTransitions />
</head>
Expand All @@ -36,6 +50,7 @@ const isProd = import.meta.env.PROD;
<AsideTailwindClasses />
<!-- Dev tools -->
{!isProd && <TailwindIndicator />}

<script>
//light-plus data-theme dark-plus in html tag
const getTheme = () => localStorage.getItem("theme") || "light";
Expand Down

0 comments on commit ea5f812

Please sign in to comment.