Get view totals per User
Individual user views are recorded in multiple places simultaneously:
- Cookie tracking records views for everyone, whether they are logged-in or not.
- Database tracking records views only for logged-in users.
# Cookie - Anonymous View Tracking
// Cookie history of current user
ViewCount::$plugin->viewCount->getAnonymousHistory();
# Database - Logged-in View Tracking
// Database history of currently logged in user
ViewCount::$plugin->viewCount->getUserHistory();
// Database history of specified user
ViewCount::$plugin->query->userHistory($userId);
Dual Tracking
It's important to note that views are tracked in both places simultaneously. Use whichever method makes the most sense for your project.