1. Help Center
  2. Sanil Ads Kit
  3. Troubleshooting

Ads and caching plugins

Updated
Applies to
Sanil Ads Kit 1.0.0
Reading time
1 min

Sanil Ads Kit writes ads as plain HTML, so it works with caching plugins and a CDN. There are two things to know.

What the cache can get wrong

Targeting conditions and the Show On (desktop or mobile) setting are checked when WordPress builds the page. A page cache stores that finished page. Every later visitor then gets the version that was stored first, even if their device is different.

Fixes

  • After changing an ad, clear your cache so the new version is built.
  • If you use Show On with full-page caching, either make your cache keep a separate copy for mobile and desktop, or switch the server-side check off so every ad is output and the stylesheet hides the wrong one:
add_filter( 'amkit_server_side_device_filter', '__return_false' );

Put that line in your theme’s functions.php or a small custom plugin.

Note

If you only target by page, category or other conditions (not by device), the cache is fine: the result is the same for every visitor.

Analytics and caching

Views and clicks are counted in the visitor’s browser, so cached pages are still tracked. Each page carries a security token that expires after a while, usually 12 to 24 hours. A cache that keeps a page longer than that can serve a page whose token has run out, and its views and clicks stop being recorded.

If the numbers in the Analytics box drop to zero on pages you know get visitors, shorten your cache lifetime to under 12 hours. See also Track views and clicks.

Was this article helpful?