Skip to content

Commit

Permalink
refactor: add gtag to window
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Apr 15, 2024
1 parent 7d6e0b2 commit eb884b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/page/GoogleAnalytics.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const { id } = Astro.props;
<script type="text/partytown" is:inline define:vars={{ id }}>
window.dataLayer = window.dataLayer || [];

const gtag = () => window.dataLayer.push(arguments);
window.gtag = function gtag() {
window.dataLayer.push(arguments);
};

gtag('js', new Date());
gtag('config', id);
</script>

0 comments on commit eb884b0

Please sign in to comment.