Why there is huge difference in Pageviews tracking number on discourse admin dahboard and on google analytics

Digging out this one…

@sam I found the post below from you which exactly described what Discourse and what Google Analytics counts as a “page view”.

Is that still how page views are counted? We are trying to reconcile if and which analytics tools to use in the future since so far GA, Plausible and Fathom all are undercounting the page views compared to Discourse’s own analytics.

My wild and uninformed guess is that they have a piece of javascript that doesn’t get fired again when those ajax calls get made. Or it may even load only once per session.

@codinghorror @sam I’ve been looking through the forum and it seems that everyone is having the opposite problem I’m having. ie: every one is reporting discourse reporting more pageviews than GA.
I’m experiencing the opposite.

When I looked into it, it shows that it is indeed firing 2 events for each pageview
Once for GA4 and then for a UA account.
I think we used to use UA but we don’t anymore. Yet, if I have anything in the “ga universal tracking code” field when inspecting the page I see both the new GA4 code as well as the old UA code.
If I remove the " ga universal tracking code" value, both of the above JS includes disappear from the page.
How do I debug this? Should I look at the database for the UA code value and figure it out that way?
I’ve looked in the SiteSettings table and I found only the GA4 code.