Skip to content

[🐞] GA4 is not working properly for Partytown with Astro  #457

@THILAK6

Description

@THILAK6

Describe the bug

We are attempting to use Partytown to track Google Analytics within an Astro TypeScript project. However, we are encountering intermittent issues where Partytown partially works. It sometimes functions as expected, but at other times, it doesn't. We have reviewed the examples provided on the Partytown website and are still facing these challenges.

Reproduction

A sample Astro project with partytown integration

Steps to reproduce

We have added this code in the layout of the project

 <script type="text/partytown" src="https://www.googletagmanager.com/gtag/js?id=YOUR-ID-HERE"></script>
  <script type="text/partytown">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'YOUR-ID-HERE');
  </script>

Browser Info

Chrome, Firefox

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions