WhoKnew Views™ | User-Specific View Memory

Skip to main content
Table of Contents
Print

🎯 Why Per-User Tracking Matters

WhoKnew Views™ Pro tracks each visitor individually to ensure accurate counting and natural variation behavior. Without per-user memory, the same visitor could artificially inflate counts by refreshing repeatedly, or see jarring count changes during their browsing session.

The user-specific memory system ensures:

  • Accurate real view counts: Each unique visitor counts once per session
  • Consistent display: Returning visitors see stable numbers
  • Per-user variation zones: Variation timing is tracked per individual, not globally
  • Analytics accuracy: First-time vs. returning visitor data is reliable

🔐 Dual Tracking System

WhoKnew Views™ Pro uses a robust dual-tracking system that works even when cookies are blocked or in incognito mode:

// From view-counter-logic.php
// ROBUST VIEW TRACKING: Works with or without cookies (incognito-friendly)
// Create unique visitor fingerprint (IP + User-Agent for better differentiation)
$remote_addr = sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'));
$user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'] ?? 'unknown'));
$visitor_fingerprint = md5($remote_addr . '|' . $user_agent);
Tracking MethodHow It WorksPersistence
Browser CookieStores session data in visitor’s browserSurvives browser closes, cleared on expiry
Fingerprint TransientServer-side tracking via IP + User-Agent hashWorks for incognito, cleared on expiry

From the plugin’s guided setup:

“The system uses fallback tracking (IP + browser fingerprint) for users with cookies disabled.”

📊 What Gets Tracked Per User

1. Session Cookie (Cookie Lifespan Duration)

Tracks whether this visitor has already been counted during the current session:

// Cookie key is unique per product + visitor
$cookie_key = 'whoknew_view_' . $product_id . '_' . $visitor_fingerprint;
// Count view if:
// 1. NOT an admin
// 2. No cookie exists (new visitor or cookie cleared)
// 3. Not within per-user cooldown period
$should_count_view = !$is_admin && !$has_cookie && !$is_within_cooldown;

This prevents the same visitor from adding multiple real views during a single browsing session.

2. Per-User Cooldown (Variation Timing)

The variation system tracks when each individual user last triggered a variation, not when the product globally received one:

// Server-side fingerprint cooldown
$fingerprint_cooldown_key = 'wkv_fp_cooldown_' . $product_id . '_' . $visitor_fingerprint;
// Set per-user fingerprint cooldown (works without cookies for incognito users)
set_transient($fingerprint_cooldown_key, $current_time, $cookie_lifespan);

This means:

  • Visitor A triggers variations based on THEIR last activity
  • Visitor B triggers variations based on THEIR last activity
  • Visitors don’t affect each other’s variation timing

3. Lifetime Cookie (90-Day Analytics)

A separate 90-day cookie tracks whether this visitor has EVER seen this product:

// ANALYTICS: Track First-Time vs Returning Visitors (90-day cookie)
$lifetime_cookie_key = 'whoknew_lifetime_view_' . $product_id . '_' . $visitor_fingerprint;
if (!$lifetime_cookie_exists) {
    // FIRST-TIME VISITOR: Never seen this product before (within 90 days)
    $first_time_views = get_post_meta($product_id, '_wkv_first_time_view_timestamps', true);
    $first_time_views[] = $current_time;
    update_post_meta($product_id, '_wkv_first_time_view_timestamps', $first_time_views);
} else {
    // RETURNING CUSTOMER: Has seen this product before (within 90 days)
    $returning_views = get_post_meta($product_id, '_wkv_returning_view_timestamps', true);
    $returning_views[] = $current_time;
    update_post_meta($product_id, '_wkv_returning_view_timestamps', $returning_views);
}

From the Insights tab:

“👀 First-Time vs. Returning Visitors – 90-day cookie system distinguishes visitor types. Know which products attract new customers vs. drive repeat traffic.”

🔄 The Complete User Journey

USER-SPECIFIC MEMORY IN ACTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VISITOR A - First Time Ever (No Cookies)
├── Fingerprint created: md5(IP + User-Agent)
├── Session cookie set: expires in 5 hours
├── Lifetime cookie set: expires in 90 days
├── Real view counted: YES
├── Variation triggered: YES (first visit = new variations)
├── Analytics: Recorded as FIRST-TIME visitor
└── Display: Shows current padded count
VISITOR A - Returns 30 minutes later
├── Session cookie found: still valid
├── Fingerprint cooldown: still active
├── Real view counted: NO (already counted)
├── Variation triggered: MAYBE (if cooldown expired)
├── Analytics: No change (already recorded)
└── Display: Same consistent count
VISITOR A - Returns next day (cookie expired)
├── Session cookie: EXPIRED
├── Fingerprint cooldown: EXPIRED
├── Lifetime cookie: STILL VALID
├── Real view counted: YES (new session)
├── Variation triggered: YES
├── Analytics: Recorded as RETURNING visitor
└── Display: Updated count
VISITOR B - Incognito Mode (No Cookies)
├── Fingerprint created: md5(IP + User-Agent)
├── Server-side transient set: works without cookies
├── Real view counted: YES
├── Variation triggered: YES
└── System: Works normally despite no cookies!

⚡ Per-User Variation Zones

The 3-tier variation system works on a per-user basis. From the simulation engine:

“Properly simulates:
• Individual user cookies
• Returning vs new visitors
• Multiple refreshes per session
• Per-user variation zones (1/2/3)
• View aging within window”

This means:

ScenarioZone for Visitor AZone for Visitor B
A visited 5 min ago, B visited 2 hours agoZone 1 (low range)Zone 2 (medium range)
Both visit for the first timeZone 1Zone 1
A is returning, B is newBased on A’s last visitZone 1 (first visit)

📋 Data Stored Per Product

The system stores analytics data in post meta for each product:

Meta KeyPurpose
_wkv_first_time_view_timestampsArray of timestamps from first-time visitors
_wkv_returning_view_timestampsArray of timestamps from returning visitors
_wkv_total_real_views_everPermanent lifetime counter (never resets)
product_viewsReal view timestamps within current window

🔒 Privacy-First Design

The user memory system is designed with privacy in mind:

  • Fingerprints are hashed: Original IP/User-Agent not stored, only MD5 hash
  • No personal data: System doesn’t track names, emails, or identifiable info
  • Cookies are httpOnly: Cannot be read by JavaScript (prevents XSS attacks)
  • SameSite: Strict: Cookies only sent to your domain
  • Secure flag: Cookies only sent over HTTPS when SSL is enabled
// Cookie security settings
setcookie($cookie_key, $cookie_value, [
    'expires' => time() + $cookie_lifespan,
    'path' => COOKIEPATH,
    'domain' => COOKIE_DOMAIN,
    'secure' => is_ssl(),
    'httponly' => true,
    'samesite' => 'Strict'
]);

💡 Best Practices

For Accurate Analytics

  • Use the Insights tab: View first-time vs. returning visitor breakdown
  • Monitor both metrics: High first-time = good discovery; High returning = loyal customers
  • Compare products: See which attract new vs. repeat traffic

For Natural Variation Behavior

  • Trust the per-user system: Variations trigger based on individual timing
  • Set appropriate cooldowns: Refresh Cooldown controls per-user variation frequency
  • Use Cookie Lifespan wisely: Longer lifespan = more consistent experience

Share