BBlack has submitted this change and it was merged.

Change subject: Mark incoming requests without cookies in x-analytics
......................................................................


Mark incoming requests without cookies in x-analytics

If a request comes without any cookies we mark it as such.
This could be a cheap proxy to identify robots but it will also
catch "fresh" sessions and users browsing with cookies disabled.

Analytics team to run numbers after we deploy these changes
to see the impact of this change on reporting unique clients per month.
https://wikitech.wikimedia.org/wiki/Analytics/Unique_clients/Last_access_solution

Bug: T114370
Change-Id: Iadaf106f396e9bc906e5c87b350ea2ccc58617c4
---
M templates/varnish/analytics.inc.vcl.erb
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  BBlack: Verified; Looks good to me, approved



diff --git a/templates/varnish/analytics.inc.vcl.erb 
b/templates/varnish/analytics.inc.vcl.erb
index 2f09773..aedf729 100644
--- a/templates/varnish/analytics.inc.vcl.erb
+++ b/templates/varnish/analytics.inc.vcl.erb
@@ -132,6 +132,12 @@
  ****************************************************************************/
 
 sub analytics_recv {
+    // If this request had no cookies whatsoever mark it as such
+    // to later report this fact to X-Analytics
+    if (!req.http.Cookie) {
+        set req.http.X-WMF-NOCOOKIES = 1;
+    }
+
     call analytics_last_access_recv_;
     call analytics_provenance_recv_;
 }
@@ -179,6 +185,10 @@
         set resp.http.X-Analytics = resp.http.X-Analytics + ";proxy=IORG";
     }
 
+    if (req.http.X-WMF-NOCOOKIES) {
+        set resp.http.X-Analytics = resp.http.X-Analytics + ";nocookies=1";
+    }
+
     // Clean up header from setting to empty at the start...
     if (resp.http.X-Analytics == "") {
         unset resp.http.X-Analytics;

-- 
To view, visit https://gerrit.wikimedia.org/r/244626
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iadaf106f396e9bc906e5c87b350ea2ccc58617c4
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Nuria <nu...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Joal <j...@wikimedia.org>
Gerrit-Reviewer: Madhuvishy <mviswanat...@wikimedia.org>
Gerrit-Reviewer: Nuria <nu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to