Skip to main content
KadiCache
Browse 37 Docs Guides & Search

Mobile Cache, Bypass/Variant Cookies & Marketing Query Strings

Configure Separate Mobile Cache wisely, manage custom bypass and variant cookies, strip 20+ ad tracking parameters (utm_*, fbclid, gclid), and opt in safe query keys.

Cache/Policy/TargetPath.phpCache/Policy/CookiePolicy.phpCache/Policy/CookieVariants.phpCache/Policy/MobileUsageHint.php
WP Admin -> KadiCache -> Tools & Diagnostics -> Cookies & Query Rules
MODULE 08 · 2X RETINA
Fine-grain bypass cookies, currency/language variant cookies, user-agent exclusions, and tracking query parameter stripping.2880×1840 WebP
Quick Summary · 30-Second Operational SpecSource-Verified Guide
WP Admin Path
WP Admin -> KadiCache -> Tools -> Cookies & Query Rules
Expected Outcome
20+ Ad Trackers Normalized · Bounded DoS-Safe Cache Keys
Key Marker / Engine
TargetPath.php | CookiePolicy.php | CookieVariants.php
  • Strips 20+ marketing & analytics query parameters (utm_*, fbclid, gclid, gbraid, msclkid, ttclid, _ga, mc_cid, srsltid, etc.) in TargetPath.php so paid ad clicks hit your primary warm cache.
  • Protects 35+ dynamic WordPress, WooCommerce & page-builder query keys (add-to-cart, wc-ajax, s, preview, elementor-preview, et_fb, bricks, _wpnonce) from ever being cached by mistake.
  • Enforces hard security bounds (QUERY_PARAMETER_LIMIT = 6, QUERY_VALUE_BYTES = 128, QUERY_VARIANT_LIMIT = 50) to prevent random query-string cache-busting floods.
  • Separates Bypass Cookies (never cache) from Hashed Variant Cookies (isolated cache buckets for currencies/languages) and provides MobileUsageHint.php guidance for Separate Cache Files for Mobile.

When to Enable (and When NOT to Enable) Separate Cache Files for Mobile#

One of the most misunderstood checkboxes in WordPress caching is Separate Cache Files for Mobile (mobile_cache_enabled) inside WP Admin -> KadiCache -> Cache. Enabling it splits every URL into two isolated cache buckets (desktop vs :mobile matched by UserAgents.php).

Your Theme & Plugin SetupShould You Enable Separate Cache Files for Mobile?Why (MobileUsageHint.php)
Modern Responsive CSS Theme (Astra, Kadence, GeneratePress, Block Themes, standard Elementor/Bricks)Keep OFF (Recommended)HTML markup is identical; CSS @media queries adapt layout. Sharing 1 cache bucket doubles your cache hit ratio!
Server-Side PHP Mobile Theme / wp_is_mobile() Logic (WPtouch, separate mobile header PHP templates, conditional mobile shortcodes)Turn ONPHP outputs different server-side HTML for phones vs desktops; separate :mobile files prevent desktop HTML from serving to phones

Marketing Query String Normalization (TargetPath::IGNORED_QUERY)#

Without query-string normalization, launching a Meta Ads, Google Shopping, TikTok, or Mailchimp campaign turns 99% of your paid ad clicks into slow 450 ms cache misses because every visitor arrives with a unique click ID (?fbclid=IwAR9x... or ?gclid=Cj0KCQ...).

TargetPath.php strips recognized attribution parameters only when computing the internal cache lookup key—leaving the full URL untouched in the visitor’s browser address bar so Google Analytics 4, Meta Pixel, and CRM attribution scripts still read every parameter accurately! Out of the box, KadiCache normalizes:

  • Wildcard Campaign Families: utm_* (utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_id), gad_*, mtm_* (Matomo), and pk_* (Piwik).
  • 21 Ad-Network & Email Click IDs (TargetPath::IGNORED_QUERY): fbclid, gclid, gbraid, wbraid, msclkid, ttclid, twclid, dclid, srsltid (Google Merchant Center), _ga, _gl, igshid, mc_cid, mc_eid, _hsenc, li_fat_id, _kx (Klaviyo), yclid, rdt_cid (Reddit), irclickid, and epik (Pinterest).
  • Custom Ignored Query Parameters: Add any proprietary affiliate or newsletter tracking parameter (one per line, or prefix ref_*) inside WP Admin -> KadiCache -> Tools -> Cookies & Query Rules!
FIG 01Managing Bypass Cookies, Variant Cookies, User-Agent Exclusions, Ignored Tracking Parameters, and Cached Query Keys inside WP Admin -> KadiCache -> ToolsZoom 2x

Protected Dynamic Query Keys & Opt-In Cache Query Strings#

What if your store has legitimate public query parameters that change page content—such as ?color=navy or ?orderby=popularity—while also needing strict protection against caching ?add-to-cart=42 or ?elementor-preview=1?

  1. Hardcoded Protected Query Denylist (TargetPath::PROTECTED_QUERY): KadiCache refuses to treat action, search, nonce, or visual-builder parameters as cacheable static variants—even if someone accidentally types them into custom rules! Protected keys include add-to-cart, remove_item, undo_item, wc-ajax, wc-api, customer-logout, s, preview, preview_id, _wpnonce, nonce, rest_route, order, order_id, key, token, password, and 11 visual builder editors (elementor-preview, et_fb, bricks, fl_builder, ct_builder, vc_editable, brizy-edit, tve, zionbuilder-preview, op3editor).
  2. Opt-In Cached Query Parameters (cacheQueryRules): Add safe catalog filter keys (up to 30 rules, e.g. orderby or filter_*) inside Cache Query Strings. TargetPath.php enforces strict DoS ceilings (max 6 parameters per request, max 128 bytes per value, and max 50 cached query variants per URL) so bots appending thousands of random ?filter_color=... combinations can never fill your disk!

Bypass Cookies vs Variant Cookies (CookiePolicy.php & CookieVariants.php)#

Inside WP Admin -> KadiCache -> Tools -> Cookies & Query Rules, KadiCache gives you two distinct cookie controls:

  • Bypass Cookies (Never Cache When Present): If a visitor’s browser sends a matching cookie name or prefix (for example vip_member_session or custom_b2b_tier_*), KadiCache skips public caching (X-KadiCache: BYPASS) so PHP renders personalized pricing dynamically. Standard WordPress (wordpress_logged_in_*, wp-postpass_*) and WooCommerce checkout/session risk cookies are already guarded automatically.
  • Variant Cookies (Cache Separately Per Cookie Value): When every visitor with preferred_region=eu sees the exact same EU catalog HTML, adding preferred_region as a Variant Cookie tells CookieVariants.php to hash the sanitized value into an isolated SHA-256 cache bucket (X-KadiCache: HIT)—giving personalized cohorts 14 ms Early HITs without leaking across cohorts, and never placing raw untrusted cookie text into filenames! (Note: 8 multilingual plugins and 4 multi-currency plugins—WPML, Polylang, TranslatePress, Weglot, CURCY, FOX, WCML, Aelia—are already configured automatically; see WooCommerce & Multilingual Guide.)
  • Excluded User-Agents (UserAgents.php): Bypass caching for specific crawlers, monitoring bots, or custom mobile app WebViews.

Step-by-Step Recipe: Auditing Third-Party Plugin Cookies Safely#

Whenever you install a new affiliate, currency, A/B testing, or popup plugin, run this 60-second check to ensure guest caching stays optimal:

  1. Inspect Set-Cookie Headers in Incognito: Open an Incognito browser window, open DevTools -> Network -> Doc, and load your homepage and a product page. Check whether any plugin sends Set-Cookie: on an anonymous arrival.
  2. Classify the Cookie’s True Purpose:
  • Pure client-side tracking cookie (read only by JavaScript, never changes PHP HTML): Ensure it does not trigger unnecessary PHP session bypasses.
  • Shared cohort/currency/country selector (3–10 fixed values like USD, EUR, GBP where all visitors in a cohort see identical HTML): Add the cookie name to Variant Cookies in Tools -> Cookies & Query Rules.
  • Unique per-user cart, quote, or login token: Keep it in Bypass Cookies so personalized data is never shared across guests.
  1. Verify With wp kadicache diagnose: Pass --format=json to confirm your newly added rule compiles cleanly into early-config.php without syntax warnings (SettingsRuleValidator.php).

Frequently Asked Operational Questions

If KadiCache ignores utm_source and fbclid for caching, will Google Analytics or Meta Pixel lose ad tracking?
No! KadiCache does NOT redirect or strip utm_* / fbclid from the browser URL bar. Client-side analytics scripts see the exact full query string in window.location.search while your server serves the warm canonical HTML file in ~14 ms.
What if one specific parameter inside utm_* must NOT be ignored on a custom integration?
TargetPath.php supports ! negation rules in custom ignored query configuration when an integration explicitly requires bypassing on a specific parameter, while keeping standard ad trackers normalized.
Why does KadiCache cap cached query variants at 50 per URL (QUERY_VARIANT_LIMIT = 50)?
Without a per-URL variant cap, automated bots crawling thousands of filter permutations (?orderby=price&min=1&max=999...) could exhaust disk inodes. Capping variants at 50 keeps popular customer filter views fast while safely bypassing rare permutations.
Do Elementor, Divi, and Bricks live visual editors work without disabling KadiCache?
Yes. Both logged-in user cookies and all 11 visual builder query parameters (elementor-preview, et_fb, bricks, fl_builder, ct_builder, vc_editable, brizy-edit, etc.) are protected automatically in TargetPath::PROTECTED_QUERY.
Should I enable Separate Cache Files for Mobile if I use Elementor or Astra?
Leave Separate Cache Files for Mobile OFF on responsive CSS themes like Astra, Kadence, GeneratePress, and standard Elementor layouts—enable it only if a plugin or custom PHP template uses wp_is_mobile() to output different HTML markup.
Gergis — Lead Systems & Cache Architect
Principal WordPress & Cloud Edge Architect
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

apps/wordpress-plugin/src/Cache/Policy/TargetPath.phpapps/wordpress-plugin/src/Cache/Policy/CookiePolicy.phpapps/wordpress-plugin/src/Cache/Policy/CookieVariants.phpapps/wordpress-plugin/src/Cache/Policy/MobileUsageHint.php
Was this engineering guide helpful?