Skip to content

Commit

Permalink
fix: gtagスクリプトにis:inlineをつけて、GA4計測できるようにした(#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-yoshikawa44 committed Sep 8, 2024
1 parent c616c8a commit bbebaa3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/GA.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ const GOOGLE_ANALYTICS_TAG = import.meta.env.GOOGLE_ANALYTICS_TAG;
<!-- Google tag (gtag.js) -->
<script
type="text/partytown"
is:inline
src=`https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_TAG}`
></script>
<script type="text/partytown" define:vars={{ GOOGLE_ANALYTICS_TAG }}>
<script type="text/partytown" is:inline define:vars={{ GOOGLE_ANALYTICS_TAG }}>
window.dataLayer = window.dataLayer || [];
function gtag() {
// eslint-disable-next-line no-undef
Expand Down

0 comments on commit bbebaa3

Please sign in to comment.