# GA4 页面浏览量 比 Discourse 页面浏览量 虚高

**URL:** <https://meta.discourse.org/t/ga4-page-views-are-inflated-compared-to-discourse-page-views/285373>\
**Category:** Bug\
**Created:** [2023 年11 月 13 日 12:42 UTC](https://meta.discourse.org/t/ga4-page-views-are-inflated-compared-to-discourse-page-views/285373 "2023-11-13T12:42:49Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
发布日期： [2023 年11 月 15 日 00:33 UTC](https://meta.discourse.org/t/ga4-page-views-are-inflated-compared-to-discourse-page-views/285373/6 "2023-11-15T00:33:04Z")

</div>

查看实现：

> <https://github.com/discourse/discourse/blob/c0c525056f3fcd942a97730ae5239f6214fce775/app/assets/javascripts/discourse/app/instance-initializers/page-tracking.js#L47-L54>

我们仅在页面更改时触发此操作，而不会在主题的无限加载时触发。

事实上，我还在本地尝试了这段代码，并确认无限加载页面不会触发多次页面浏览。

```plaintext
   appEvents.on("page:changed", (data) => {
      if (!data.replacedOnlyQueryParams) {
        debugger;
      }
    });

```

Discourse 中的 GA4 和 GA3 实现非常相似。

您仍然可以重现此问题吗？

---

_[View the full topic](https://meta.discourse.org/t/ga4-page-views-are-inflated-compared-to-discourse-page-views/285373)._
