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

Anyone else seeing big discrepancies between Google Analytics “page views” and API Calls on the dashboard these days? Particularly on our hosting or self hosting?

Digital Ocean hosting, tests-passed

9,789 Api Requests in last 7 days
(1,466 crawlers, 4,891 Logged in, 3,432 Anon)

6,532 Pageviews

Not orders of magnitude like the OP, but still a 50% increase from the google figure. The proportions hold up historically - google consistently reports ~1.5x as many page views as API calls.

We are seeing very big differences here:

The ‘pageviews’ according to Discourse are 65K, but according to GA they are only 13K.

So something is not right here.

I am working on reconciling this at the moment and am adding more internal diagnostics.

In particular I will ensure we set a header on every response that generates a page view.

Off the bat a big discrepancy is that analytics does not count web crawlers or anything that does not run JavaScript

Same here. For one day I had:

Google Analytics //

  • 163 Sessions
  • 61 Users (Logged and Anonymous)
  • 1 863 pages views

Meanwhile the dashboard report:

  • 4 800 Pages Views

16 from webcrawler an bots
2 500 from logged users
2 300 from anonymous

2.5x times more. That will put me in the 140k PV per month and the site is not launched yet. I am quite worry I will bust the 650k by far.

Since my original message I have reconciled multiple sites multiple times.

We simply count differently to what google does.

Google uses JavaScript ajax calls to count page views. We work hard only to issue them on first load or when you transition routes (like move from topics to latest list)

Our Page View counting is performed on the “raw requests” made (accounting for a header that informs us when to count)

Bots, JavaScript disabled are counted by us but omitted from Google.

It is worth mentioning that we added better bot user agent reporting plus user agent blacklist and whitelist support in 2.0 to deal with badly behaved bots of which there are .. many.

Has something changed recently? My Google analytics are showing a big drop in traffic but my Discourse stats do not reflect the same kind of drop?

We more aggressively throttle bots and crawlers in Discourse 2.0, particularly Bing which was pathologically bad. You can search if you are curious.

I am seeing the exact same thing…

May 2018

June 2018

July 2018

Hi @codinghorror, The thing is, my discourse stats have remained more or less consistent, it is my Google analytics which have dropped - at pretty much the same time as I added the advertising code. Wondering whether it is possible my ad code is interfering with the Google Analytics somehow.

@jerdog did you add any new plugins or code to the site? Seem to have recovered in your last screengrab?

The only plugin I added in that span of time is the GitHub - discourse/discourse-github-linkback: DEPRECATED: Links github content back to a Discourse forum · GitHub

It has begun to normalise again starting a few days ago which makes me wonder what happened to the codebase that might have contributed between June and late Sept?

Does anyone else see the same thing?

To me it looks like you had some sort of bug going where zero traffic was reported to analytics. I know we recently reorganised how we do analytics so it is very possible you still have the bug going but our new design works around your bug.

Hmm - ok I’m not seeing that across the rest of our properties so it’s a bit strange.

Not having checked my analytics for a while, it seems the issue is fixed since early August, so possibly fixed by the change you suggested above! nice one! :grinning:

يبدو أن Discourse يُبلغ عن مشاهدة صفحة في GA فقط عند التحميل الأول للصفحة، لكنه يتتبع داخليًا مشاهدة صفحة في كل مرة يتم فيها تحميل صفحة محتوى جديدة مضمنة.

يبدو أنه سيكون من الأنسب أن يُبلغ Discourse عن مشاهدة صفحة في GA في كل مرة يتم فيها تحديث الرابط.

على سبيل المثال: قم بتحميل مناقشة، يكون الرابط هو /t/topic/1000، انتقل إلى الأسفل وتحميل الصفحة التالية من المنشورات، يتم تحديث الرابط إلى /t/topic/1000/20، ويجب تسجيل مشاهدة صفحة جديدة في GA مع هذا الرابط.

هل تقصد الصفحة الأولى للموضوع (أول 20 منشورًا)؟ نعم، هذا هو كيفية عملها.

نعم، يبدو أن Discourse يتتبع عدد مرات عرض الصفحة داخليًا بطريقة مختلفة عما يُبلغ به إلى GA، وهو ما يفسر سبب ظهور أرقام GA بشكل متسق أقل.

سيكون من الرائع إصلاح الأمر بحيث يتم إرسال عدد مرات عرض صفحة جديد إلى GA في كل مرة يتغير فيها الرابط.

لا، هذا ليس السبب في اختلاف الأرقام. السبب هو التالي:

نصف المستخدمين يتصفحون اليوم باستخدام أدوات حظر الإعلانات التي تمنع تتبع Google Analytics، بينما يمكن لأرقام Discourse الداخلية عد هذه الزيارات.

سيكون ذلك غريبًا. نحن نقوم بتحديث الرابط لكل منشور، هل تعتقد أن قراءة هذا الموضوع يستحق 40 عرض صفحة؟

أنت محق، التحديث في كل منشور سيكون مبالغًا فيه. ومع ذلك، فإن تحميل الصفحة التالية من المنشورات يجب أن يُحتسب كمشاهدة جديدة لصفحة. (واستخدام الرابط الموجود في شريط العناوين هو الخيار الطبيعي لهذا الغرض.) وإلا فإننا سننتهي بأرقام مشاهدات الصفحات في GA أقل بكثير مما يعكس فعليًا نشاط المنتدى.