XF 2.1 Does guest page caching effect "views"?

frm

Well-known member
I am closely monitoring the number depicted on XF's "view count" as well as Google Analytics.

GA shows that there are tremendously more views on a given thread than what XF represents, sometimes as much as 3x.

My only conclusion is that the page is cached and therefore the view count doesn't increase.

If this is the case, is there a way to increase views to be as accurate, or even as close to being as accurate to the numbers shown in GA, without disabling caching (if that's the cause)?
 
Anybody else experiencing issues with XF and view counts, and if so, is guest page caching the cause? They are considerably lower than what Google Analytics is showing (1/4th to 1/3rd) and they are also considerably lower than "Facebook link clicks" from shared posts. It doesn't add up.

@Chris D?
 
I'm not using xf2.1 for my big board. (still using xf1.5) But views are an important motivator for our members as well as advertisers.
 
Last edited:
  • Like
Reactions: frm
Isn't the view increased on page loading (server-side)? If so, then caching would block this behavior.
I've seen the code that does it (PHP) but don't understand if that portion is run or not per visit.

I'm running memcached and have guest page caching on.

Views will be 3177 on GA while reported as 941 on XF.

This number can be discouraging if you're having people guest post and they see X while it's really Y; they might not want to again. Why would someone want to post again when they see they got 100 views, in actuality it's 500?

If the number isn't updating because of guest page caching then it'll look like I'll need to use GA API to pull real numbers and update on a cron...
 
I've seen the code that does it (PHP) but don't understand if that portion is run or not per visit.

I'm running memcached and have guest page caching on.

Views will be 3177 on GA while reported as 941 on XF.

This number can be discouraging if you're having people guest post and they see X while it's really Y; they might not want to again. Why would someone want to post again when they see they got 100 views, in actuality it's 500?

If the number isn't updating because of guest page caching then it'll look like I'll need to use GA API to pull real numbers and update on a cron...
Using GA for that seems to be the hard way. A JS that calls your pageview endpoint or a logstash (and something to count your records, an Elastic works but is overkill for counters) on your cache servers would yield better results as it is not affected by ad blockers and the second is not even affected by disabling JS.
 
  • Like
Reactions: frm
I am not sure but long back i asked same question and the answer is
xF only shows the number of Members online today

in Analytics it shows member + Guest activity.

So your GA will always show page views and number of visitor on higher side as compare to xF
 
I am not sure but long back i asked same question and the answer is
xF only shows the number of Members online today

in Analytics it shows member + Guest activity.

So your GA will always show page views and number of visitor on higher side as compare to xF
Hmmm... one would believe that views is a total of both guests and members, otherwise I wouldn't have 941 in the first example, as I don't have that many members, or members are visiting it multiple times?
 
Using GA for that seems to be the hard way. A JS that calls your pageview endpoint or a logstash (and something to count your records, an Elastic works but is overkill for counters) on your cache servers would yield better results as it is not affected by ad blockers and the second is not even affected by disabling JS.
I think I'd still have to pull GA for historical records and then move forward with another method unless somehow, if guest page caching is the cause and XF doesn't directly fix this issue with cached JS to update a view, to find my own way as I brought up it's demotivated, but @Alfa1 brought up marketing as well—I can always prove numbers by showing GA, but inquiries might come to me, as opposed to me them, if they see higher numbers that are accurately reflecting true usage.
 
Still have not received an answer to this phenomenon.

An advertiser approached me about 3 weeks ago with a view count of a particular area of our forum (an add on that shows total views of all content) asking if that was only the amount of traffic we received and I told them that we run aggressive page caching and CDN's so the number doesn't depict the true nature of traffic. I pulled Google Analytics for the combined pages, sitting at about 4 times of that reported, being majorly off. One would assume an advertiser would go with the GA statistics, but, they never responded as the number on the widget block probably led them to their own conclusion of it being less, not knowing that GA is much much more accurate.

Is there either a way to accurately track views on XF itself with caching (or whatever the problem may be, such as loading a javascript element on the page to update the view or something) or is there an add on that connects to GA's API to infrequently update views for everything?
 
What is your config for page cache, did you followed the guide at https://xenforo.com/xf2-docs/manual/cache/

$config['pageCache']['recordSessionActivity'] (default: true) - if true, a session activity record will be updated when a page is served from the cache. This will make the online user count more accurate at the expense of requiring additional work when serving a cached page.
 
What is your config for page cache, did you followed the guide at https://xenforo.com/xf2-docs/manual/cache/

$config['pageCache']['recordSessionActivity'] (default: true) - if true, a session activity record will be updated when a page is served from the cache. This will make the online user count more accurate at the expense of requiring additional work when serving a cached page.
That line is not in there, so I am only assuming that if it's not (i.e. not explicitly set to false) that it doesn't matter as the default is true and the line $config['pageCache']['recordSessionActivity'] = true; isn't necessary?
 
That line is not in there, so I am only assuming that if it's not (i.e. not explicitly set to false) that it doesn't matter as the default is true and the line $config['pageCache']['recordSessionActivity'] = true; isn't necessary?
I am not sure about it but i had seen that line used by @eva2000 explicitly in his config in Tutorials posted by him at Centminmod
 
  • Like
Reactions: frm
Also seen somewhere at community.centminmod.com about, if you wish xF to count all views from page cache too, you should add that line in config.

You can search for cache config example at centminmod, eva did explain well many times for how to config cache for xF.
 
  • Like
Reactions: frm
Top Bottom