FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove beaconCounts and counts api · devhttps/frontend@b66e09f · GitHub

Commit b66e09f

Browse files
Richard Nguyen
committed
Remove beaconCounts and counts api
1 parent 5716bc3 commit b66e09f

3 files changed

Lines changed: 1 addition & 48 deletions

File tree

‎diagnostics/app/controllers/DiagnosticsController.scala‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,11 @@ import org.joda.time.format.ISODateTimeFormat
1212
class DiagnosticsController extends Controller with Logging {
1313
val r = scala.util.Random
1414

15-
def acceptBeaconOptions = postOptions
16-
17-
def acceptBeacon = Action { implicit request =>
18-
countsFromQueryString(request)
19-
TinyResponse.ok
20-
}
21-
2215
def analytics(prefix: String) = Action { implicit request =>
2316
Analytics.report(prefix)
2417
TinyResponse.gif
2518
}
2619

27-
// e.g. .../counts?c=pv&c=vv&c=ve
28-
def analyticsCounts() = Action { implicit request =>
29-
countsFromQueryString(request)
30-
TinyResponse.gif
31-
}
32-
33-
private def countsFromQueryString(request: Request[AnyContent]): Unit = {
34-
request.queryString.getOrElse("c", Nil).foreach(Analytics.report)
35-
}
36-
3720
private lazy val jsonParser = parse.tolerantJson(1024 *1024)
3821

3922
def css = Action(jsonParser) { implicit request =>

‎diagnostics/conf/routes‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ GET /_healthcheck controllers.HealthCheck.healthCheck(
66

77
GET /count/$path<.+>.gif controllers.DiagnosticsController.analytics(path)
88

9-
GET /counts.gif controllers.DiagnosticsController.analyticsCounts()
10-
119
GET /robots.txt controllers.Assets.at(path="/public", file="robots.txt")
1210

1311
POST /css controllers.DiagnosticsController.css
@@ -20,9 +18,6 @@ POST /commercial-report controllers.DiagnosticsController.co
2018
OPTIONS /commercial-report controllers.DiagnosticsController.commercialOptions
2119
GET /commercial-reports/:dateTime controllers.DiagnosticsController.commercialReports(dateTime)
2220

23-
POST /accept-beacon controllers.DiagnosticsController.acceptBeacon
24-
OPTIONS /accept-beacon controllers.DiagnosticsController.acceptBeaconOptions
25-
2621
GET /quiz/results/:quizId controllers.QuizzesController.results(quizId)
2722
OPTIONS /quiz/results/:quizId controllers.QuizzesController.resultsOptions(quizId)
2823
POST /quiz/update controllers.QuizzesController.update()

‎static/src/javascripts/projects/common/modules/analytics/beacon.js‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@ define([
1111
) {
1212
var canBeacon = !!navigator.sendBeacon;
1313

14-
function buildCounts(keys) {
15-
return map(isArray(keys) ? keys : [keys], function (key) {
16-
return 'c=' + key;
17-
}).join('&');
18-
}
19-
20-
// note, support is reasonably limited https://developer.mozilla.org/en-US/docs/Web/API/navigator.sendBeacon
21-
function beaconCounts(keys) {
22-
var url;
23-
if (canBeacon) {
24-
url = config.page.beaconUrl + '/accept-beacon?' + buildCounts(keys);
25-
return navigator.sendBeacon(url, '');
26-
}
27-
}
28-
2914
return {
3015
fire: function (path) {
3116
var img = new Image();
@@ -50,16 +35,6 @@ define([
5035
crossOrigin: true
5136
});
5237
}
53-
},
54-
counts: function (keys) {
55-
if (canBeacon) {
56-
return beaconCounts(keys);
57-
} else {
58-
var query = buildCounts(keys);
59-
return this.fire('/counts.gif?' + query);
60-
}
61-
},
62-
63-
beaconCounts: beaconCounts
38+
}
6439
};
6540
});

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL