Skip to content

Commit d333a96

Browse files
authored
Revert "Respect dnt in JS tracker (milesmcc#257)"
This reverts commit 4ffc3bd.
1 parent c4410c4 commit d333a96

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

shynet/analytics/templates/analytics/scripts/page.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
//
66
// This script only sends the current URL, the referrer URL, and the page load time. That's it!
77

8-
{% if dnt %}
98
var Shynet = {
10-
dnt: true
11-
};
12-
{% else %}
13-
var Shynet = {
14-
dnt: false,
159
idempotency: null,
1610
heartbeatTaskId: null,
1711
skipHeartbeat: false,
@@ -59,8 +53,6 @@ var Shynet = {
5953
};
6054

6155
window.addEventListener("load", Shynet.newPageLoad);
62-
{% endif %}
63-
6456

6557
{% if script_inject %}
6658
// The following is script is not part of Shynet, and was instead

shynet/analytics/views/ingress.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from django.utils import timezone
1616
from django.utils.decorators import method_decorator
1717
from django.views.decorators.csrf import csrf_exempt
18-
from django.views.generic import View
18+
from django.views.generic import TemplateView, View
1919
from ipware import get_client_ip
2020

2121
from core.models import Service
@@ -119,7 +119,7 @@ def get(self, *args, **kwargs):
119119
"service_uuid": self.kwargs.get("service_uuid"),
120120
},
121121
)
122-
if self.kwargs.get("identifier") is None
122+
if self.kwargs.get("identifier") == None
123123
else reverse(
124124
"ingress:endpoint_script_id",
125125
kwargs={
@@ -129,9 +129,6 @@ def get(self, *args, **kwargs):
129129
)
130130
)
131131
heartbeat_frequency = settings.SCRIPT_HEARTBEAT_FREQUENCY
132-
dnt = self.request.META.get("HTTP_DNT", "0").strip() == "1"
133-
service_uuid = self.kwargs.get("service_uuid")
134-
service = Service.objects.get(pk=service_uuid, status=Service.ACTIVE)
135132
return render(
136133
self.request,
137134
"analytics/scripts/page.js",
@@ -141,7 +138,6 @@ def get(self, *args, **kwargs):
141138
"protocol": protocol,
142139
"heartbeat_frequency": heartbeat_frequency,
143140
"script_inject": self.get_script_inject(),
144-
"dnt": dnt and service.respect_dnt,
145141
}
146142
),
147143
content_type="application/javascript",
@@ -163,7 +159,7 @@ def post(self, *args, **kwargs):
163159
def get_script_inject(self):
164160
service_uuid = self.kwargs.get("service_uuid")
165161
script_inject = cache.get(f"script_inject_{service_uuid}")
166-
if script_inject is None:
162+
if script_inject == None:
167163
service = Service.objects.get(uuid=service_uuid)
168164
script_inject = service.script_inject
169165
cache.set(f"script_inject_{service_uuid}", script_inject, timeout=3600)

0 commit comments

Comments
 (0)