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.
- Strips 20+ marketing & analytics query parameters (
utm_*,fbclid,gclid,gbraid,msclkid,ttclid,_ga,mc_cid,srsltid, etc.) inTargetPath.phpso 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.phpguidance forSeparate 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 Setup | Should 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 ON | PHP 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), andpk_*(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, andepik(Pinterest). - Custom Ignored Query Parameters: Add any proprietary affiliate or newsletter tracking parameter (one per line, or prefix
ref_*) insideWP Admin -> KadiCache -> Tools -> Cookies & Query Rules!
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?
- 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 includeadd-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). - Opt-In Cached Query Parameters (
cacheQueryRules): Add safe catalog filter keys (up to30rules, e.g.orderbyorfilter_*) inside Cache Query Strings.TargetPath.phpenforces strict DoS ceilings (max6parameters per request, max128bytes per value, and max50cached 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_sessionorcustom_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=eusees the exact same EU catalog HTML, addingpreferred_regionas a Variant Cookie tellsCookieVariants.phpto hash the sanitized value into an isolated SHA-256 cache bucket (X-KadiCache: HIT)—giving personalized cohorts14 msEarly 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:
- Inspect
Set-CookieHeaders in Incognito: Open an Incognito browser window, open DevTools -> Network -> Doc, and load your homepage and a product page. Check whether any plugin sendsSet-Cookie:on an anonymous arrival. - 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,GBPwhere all visitors in a cohort see identical HTML): Add the cookie name to Variant Cookies inTools -> Cookies & Query Rules. - Unique per-user cart, quote, or login token: Keep it in Bypass Cookies so personalized data is never shared across guests.
- Verify With
wp kadicache diagnose: Pass--format=jsonto confirm your newly added rule compiles cleanly intoearly-config.phpwithout 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?
What if one specific parameter inside utm_* must NOT be ignored on a custom integration?
Why does KadiCache cap cached query variants at 50 per URL (QUERY_VARIANT_LIMIT = 50)?
Do Elementor, Divi, and Bricks live visual editors work without disabling KadiCache?
Should I enable Separate Cache Files for Mobile if I use Elementor or Astra?
Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.