WebCenter Document Hit Counts

Wondering how popular your Plumtree Knowledge Directory documents are? Sure, you could use WebCenter Analytics, but did you know that Plumtree has always captured card download metrics?

Try this query to get hit counts for each card in the KD, and marvel in the awesomeness that is your popular documents – regardless of how many times your Analytics collector dies:

SELECT     ptc.name, ptcs.CARDID, ptcs.POPULARITY, ptcs.HITCOUNT, ptcs.LASTHIT
FROM         PTCARDSTATISTICS ptcs, PTCARDS ptc
WHERE     (LASTHIT > GETDATE() - 30) AND (HITCOUNT > 0) and (ptcs.cardid = ptc.objectid)
ORDER BY HITCOUNT DESC

Interesting side note – notice how all those document hit counts are a multiple of 10? The reason for this is a scalability approach that Plumtree came up with years ago. The idea is that rather than writing to the database every single time a document is downloaded, the code only increases the hit count 10% of the time, but increases the count by 10 each time. So, statistically, the counts are accurate over time, but the database is written to much less frequently.

Tags: , , ,

4 Responses to “WebCenter Document Hit Counts”

  1. Geoff Garcia says:

    Where/how does the system remember the hit count for each document to know when to make the incremenet?
    “… rather than writing to the database every single time a document is downloaded, the code only increases the hit count 10% of the time, but increases the count by 10 each time. So, statistically, the counts are accurate over time, but the database is written to much less frequently.”

  2. Quentin Lami says:

    We have noted some inconsistencies in what’s being updated in the PTCARDSTATISTICS table compared to what the Analytics console says. We see examples where Analyitics indicates documents have been accessed this month more than 10 times. However, the PTCARDSTATISTICS indicate a HITCOUNT of 0 and a LASTHIT of last month or even longer. I am not sure if this is specific to our environment or not, but I would be mindful of these findings!

    • Matt Chiste says:

      True, it is possible that you could see 0 hits for a rarely used document. That’s because if you hit it once, you only have a 1 in 10 chance of the hit actually being recorded. Statistically, if you hit it 10 times, one of those 10 hits should record a hit and increment the counter by 10. So if a document is loaded 1,000 times, statistically the database should get written to 100 times and total 1,000 hits. But, as you know, flipping a coin 10 times won’t mean that you’re going to have EXACTLY 5 heads and 5 tails – each flip is independent of the others. So, really, this counter only works with large sample sizes so that the number will be closer to reality. But if you’re looking at document hits in the 10-20 range, you’re absolutely right that the number could be “way off” and show 0. Alternatively, in theory three actually hits could end up being recorded as 30 (3×10) in the database.

Leave a Reply