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.

1 Like

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.


My feelings toward Google and their UI and is the same feeling for the Windoze approach of yore, shyte. But GA4 takes the biscuit. What’s the point. This GA4, can’t seem to even do an hourly report of traffic stats! Why should I have to step into another suite to get what I need.

The solution for all may be to simply ditch it. It would be neat to have a hourly user visit graph in admin, basic traffic display that is live.


I’m getting an even bigger gap between old UA figures and the newer GA4 pageviews.

And my Adsense Pageviews is a fraction of both, like, a tiny fraction.

Hi @sam

Just trying to get my head around this in relation to GA4 and maybe to help the less technical users like myself here to understand the difference in layman’s terms.

Are you saying that when a user scrolls down a long thread and the next 20 posts load, GA4 is counting this automatic page load as A Page View? The user is not actually changing the page manually but essentially it is a new page of content, so it makes sense to count that as a pageview. On an older forum, you’d have had to click PAGE 2, PAGE 3, and so on in pagination, to work your way through a long conversation but the infinite scroll is doing this automatically for you.

Whereas the Discourse’s internal Page View metric is only counted when you actually click to a new Topic / Do a full change of page?

Or is that an oversimplification of what you mean?

I’m just trying to understand why my GA4 pageviews are so much higher than my Discourse ones.

This is for yesterday and it’s not even an extreme example as this is a quiet time on my site but it shows the difference:

So my GA4 is saying 39K Pageviews yesterday:

But Discourse itself is saying:

Okay, so I just ran a test on a thread on my site that is not very busy normally. It’s an old thread that is long so perfect for testing this out.

At the start of the test, it had no pageviews in the GA4 real-time list of pages over the previous 30 minutes, I scrolled down through several hundred posts on the thread and then checked my GA4 real-time view again, and I now have 25 pageviews for that page in the last 30 mins.

So it seems each automatic page load is counting as a pageview in GA4. Which I think makes sense, just because the next page is loaded automatically, it’s still a page view to my mind.

So this might explain the differences some users are getting where some of us have more GA4 views than discourse Pageviews, this could happen when you have busy long threads, which my site very much has. Whereas users with more threads but fewer long threads might see more Dicoruse Page Views than GA4 because of the differences Sam listed above (GA not counting JS disabled views etc).


IIRC, if you turn off javascript you can see discourse in pagination.

Might help your accounting test.

I could never reconcile Discourse stats, just loggedd in users alone, what exactly is 1 logged in user, is it really just that, just 1 logged in user?

I’d find logged in users total in Discourse states would could be approx 3/4 times more than the Google (non-GA4) users total for the day.

1 Like

Coming back to this again but comparing both GA4 and discourse page views to Google AdSense page views. I think there’s a profound issue with the Pageviews on Google AdSense compared to Google Analytics (GA4) and the Discourse stats, even using the official Ad Plugin.

As above GA4 seems to be counting the infinite scrolls as a new page view, which is correct in my opinion, On older software these would have made you use Pagination to get to the next set of posts which would require a full page load so loading the next set of posts is a dynamic or virtual pageview i think i saw it described as.

Discourse as explained above, is only counting when someone changes to a new page by changing thread or going to the homepage and creating a full new page load. This is fine, although I think the infinite scrolls are valid page views.

But Google AdSense is coming in with a far, far lower PageView total than even the Discourse total.

Take for example Saturday, July 15th, 2023

  • On GA4 I had 152,000 Page Views:
  • On Discourse I had 93,561 Page Views - the difference makes sense as outlined above:
  • On Google AdSense, using the official Plugin, I had 6,000 page views and made a whole €3.55

I realize AdSense page views are lower as they only count pages with Ads on them but I had ads in several positions on pretty much every page on the site and every 20 posts on threads, even allowing for Adblockers and crawlers or whatever that drop-off cannot be right … can it?

I think there are a couple of problems here, I suspect that Adsense, like Universal Analytics before it, is not counting the infinite scroll / virtual page views but I don’t think it’s even counting the page views that discourse is counting. Not even close.

Fathom Analytics Test

I ran an experiment using Fathom Analytics for a week using Tag Manager to add the code to my site, with it set to trigger on Page Views

Using the GTM debugger i noticed that you could browse several pages of the site and the tag could only ping once, i left it running like that for a week and the VIEWS were way down on GA4

With that setup Fathom had only 7.3K views
GA4 on the same date had 62K
Discourse Had:34K

I had disabled Adsense at that stage while running the tests but it seems like a very similar rate of fall-off.

I read up a bit on SPA and saw that adding the HISTORY Tigger might be suited to Discourse:

I added it and left it to run for a couple of weeks and you can see the jump:

August 15th got 37.5K views in Fathom, which tallies with my GA4 stats for that day:

There’s an interesting thread on it here:

After nearly three weeks of running display ads using the official Discourse ad plugin, we can confirm all our previous views based on SEO analysis of single page application (SPA) web sites.

Discourse is the worst performing web-site, from an ad revenue perspective, of any of the many web-sites we have managed over the years. Summary:

  • Google “sees” the initial page load as a “page view” but subsequent views after the initial page load of the SPA application is not “seen” as a “page view”.
1 Like

This seems like a serious issue for anyone wanting to monetize their effort/traffic.

Maybe I have this wrong but seems to me like the AdSense plugin is not triggering on dynamic page loads, I suspect it’s not even triggering on what discourse counts as a page view which can’t be right, can it?

I have managed to hook up the AdSense code using GTM and have set it to HISTORY as above, will report back as to the pageviews it gets now.


As per my post above - As an experiment, I have added AdSense to my site using GTM.

The GTM method is not perfect by any means - as you can see in this Screencast, it shows tags not firing on-page changes, or rather, the tags are firing in the GTM debugger but Ads are not showing when you browse the site.

You can see from the video that when set to trigger on ALL PAGES you seem to be able to browse the site from thread to thread and not trigger the tags at all, even going from the homepage to another thread and back out again and into another thread.

Whereas the tags that are set to “History” aka “all” trigger seem to trigger with each page change, from page to page, and also when you trigger an infinite scroll.

Here’s the GTM definition of the HISTORY (ALL) trigger:

But even with the tags triggering the ads aren’t loading when i browse the site. But as you can see from the stats below, I’m still getting better Page Views in AdSense as a proportion of my GA4 traffic than i was with the Ad Plugin.

I wonder if something similar is happening with the official ad plugin. The PageViews were worse (see in more details below) when I was using the plugin, compared to the first couple of days of my experiment using Tag Manager to add them.

As you can see below:

So on my July 15th data above:

  • Google Analytics GA4: had 152K PageViews
  • Google Analytics GA4: had 6.8K First Visit Events
  • Discourse Logged: 93K Page Views
  • Google AdSense: 6K Page views

That first visit event and the AdSense Page Views seem remarkably similar - is Google AdSense tracking anything outside the first page load of each visit?

EDIT to add some early data on my Adsense - GTM Adsense

Google Analytics page views from June 2 to August 26 - you can see where the high profile part of the season ends July 31st = 211K Page views:

Google AdSense page views:


  • I was using the official plugin up to July 31
  • I removed Adsense Aug 3 to Aug 23 = the bottoming out.
  • Added Adsense with Google Tag Manager Aug 24

You can see that despite the major issues in the screencast above, and with much lower overall traffic I’m getting a much higher Adsense Page view proportionately per GA4 Page view using GTM to attach Adsense than I was with the official plugin.

  • So Yesterday I had 53K Page Views in GA4
  • With 7K Page Views in AdSense (using deeply flawed GTM method as shown in video)
  • This is a 13% hit rate of AdSesne page views to GA4 page views
  • Whereas with the Official AdPlugin, I was getting a 3.9% AdAense to GA4 PV count.

Weirdly using the official Plugin I had many more ads on the site and they showed when you browsed from page to page much better than using GTM, but the pageviews being recorded in AdSense were a fraction of what they should be.

I think there’s something wrong with the AdPlugin and how it is triggering, or rather, not triggering on dynamic page loads.

Does the AdButler or any of the other Ad integrations track pageviews any better given the somewhat unique nature of discourse?


@Shaneod I agree with what you say. Discourse’s adsense advertising revenues are really low. As you said, adsense does not count page views. The official ad plugin needs an arrangement to trigger when the page url changes and count page views. Adsense Page views are a situation that increases the number of ads with high cpc and increases ad revenues. I hope an update will be released about this.


Yeah, it’s like it is not correctly triggering on any page view outside the first page or a full refresh. Or certainly the vast majority of page views are being lost.

for example in July i had

  • 172K First Visit Events in GA4
  • 177K Page Views in Google AdSense

Those numbers are far too close to be a coincidence imo.

Over that timeframe:

  • Discourse counted 1.7 Million Page Views
  • Google Analytics counted 3.9 Million (I have a lot of long threads).

All the subsequent page views seem to be lost on AdSense.


Have you tried Adbutler or any of the other integrations using the Ad Plugin? i assume they will have the same problem?

For more than 1 year I have been using adsense in the advertising plugin. I have the same display problem. I did a lot of research in the forum, I could not find a solution. I tried the solutions for the single page app outside the forum and I did not succeed. There were times when the number of page impressions per day was 150 thousand and these statistics were not reflected in adsense. At the same statistic rate, I saw that wordpress and other forum software earned more.

1 Like

Tbh my historical experience is adsense collapsed with Discourse (page views), this is going back over 4 years ago, it would have been good to realise that before moving over that Discourse was going to be a disaster for ad revenue due to the collapse in page view count. You live and learn, but it can destroy the viability of a site. You’ve done a lot more in-depth analysis and it’s good to see.

Add to that, in more recent times, Adsense has collapsed overall best I can tell. So now it’s a double whammy.

If you read the woes of other site owners across all kinds of other platforms, it’s collapsed systemically, and it was notable dead on discourse. I think Google has had its day in many respects too, but it doesn’t help if you platform or plugin is not working 100%.


Very worrying if this has been going on for 4 years and there’s no fix in sight?

I assume the same problem happens if you use AdButler or any of the other official Discourse Ad Plugin integrations?

The new Google Analytics GA4 is counting the dynamic page views/history changes as a Page View event and is counting the infinite scrolls on longer threads as Page View Events, so that’s a positive.

But the Adsense integration within the Ad plugin does not seem to count either the dynamic page view infinite scrolls or even page changes as Page Views which basically renders the plugin broken.

it really needs to be looked at. Is it fixable?


Yea decided to ditch google wholesale as it wasn’t worth it or a balanced relationship, all the analytics goo they were sucking for virtually zero payback, and with the dawn of Ai Borg being the final nail in the coffin.

What % of this collapse was compounded by the woeful performance of ads on Discourse, I have no idea, but it was very bad from day one thinking it was going to fix after a few months of crawling and rebalance but no, it simply got worse in line with trends, and now the industry is borked for many.

It was so bad I know one other site admin who quickly moved off discourse to another because of the ads after only a short while in discourse. They may have posted here. I think they did. The performance was shocking, but we don’t all have the technical chops to figure out or sleuth as you have, and much has changed in that time frame too, between algos and version and trends on the net. So many variables.

Bottom line pageviews collapsed, like off the cliff and never recovered.

So it’s a no recommendation in terms of Ads revenue if that aspect is 50% of your criteria, it’s a show stopper. it would have been nice to know in advance, most probably I would not have migrated over and did more research, but research on the fly is sometimes the only option too. You live and learn.

1 Like