Automattic / Automattic/jetpack

Stats tracker is easily cached, thus breaking jetpack_honor_dnt_header_for_stats

Open
#9,549 5 comments 0 reactions 0 assignees View on GitHub
[Feature] Stats Data [Focus] Privacy [Pri] Low [Status] Auto-allocated [Status] Stale Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

It would appear that the stats tracker is easily cached, thus breaking the purpose of the `jetpack_honor_dnt_header_for_stats` filter.

For example, if I were to clear Varnish and visit the site's main page and the most recent post from a browser *without* DNT set, the stats code would appear in the footer for all future visits (regardless of DNT setting) to the site's main page and the most recent post.

The opposite is also true, if I were to clear Varnish and visit the site's main page and the most recent post from a browser *with* DNT set, the stats code would not be added to the footer for all future visits (regardless of DNT setting) to the site's main page and the most recent post.

The breakdown appears to be that this is operating similar to PHP sessions, which means that the only way to effectively target DNT is to break the cache on every page load, which is not good.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with Varnish using browsers with and without DNT, then locate the stats tracker and the jetpack_honor_dnt_header_for_stats filter in the repository. Done means the stats code is not incorrectly shared between cached responses for different DNT settings, without requiring every page load to bypass caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
analytics, backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.