Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Respect dnt in js tracker" #321

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions shynet/analytics/templates/analytics/scripts/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
//
// This script only sends the current URL, the referrer URL, and the page load time. That's it!

{% if dnt %}
var Shynet = {
dnt: true
};
{% else %}
var Shynet = {
dnt: false,
idempotency: null,
heartbeatTaskId: null,
skipHeartbeat: false,
Expand Down Expand Up @@ -59,8 +53,6 @@ var Shynet = {
};

window.addEventListener("load", Shynet.newPageLoad);
{% endif %}


{% if script_inject %}
// The following is script is not part of Shynet, and was instead
Expand Down
10 changes: 3 additions & 7 deletions shynet/analytics/views/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from django.views.generic import TemplateView, View
from ipware import get_client_ip

from core.models import Service
Expand Down Expand Up @@ -119,7 +119,7 @@ def get(self, *args, **kwargs):
"service_uuid": self.kwargs.get("service_uuid"),
},
)
if self.kwargs.get("identifier") is None
if self.kwargs.get("identifier") == None
else reverse(
"ingress:endpoint_script_id",
kwargs={
Expand All @@ -129,9 +129,6 @@ def get(self, *args, **kwargs):
)
)
heartbeat_frequency = settings.SCRIPT_HEARTBEAT_FREQUENCY
dnt = self.request.META.get("HTTP_DNT", "0").strip() == "1"
service_uuid = self.kwargs.get("service_uuid")
service = Service.objects.get(pk=service_uuid, status=Service.ACTIVE)
return render(
self.request,
"analytics/scripts/page.js",
Expand All @@ -141,7 +138,6 @@ def get(self, *args, **kwargs):
"protocol": protocol,
"heartbeat_frequency": heartbeat_frequency,
"script_inject": self.get_script_inject(),
"dnt": dnt and service.respect_dnt,
}
),
content_type="application/javascript",
Expand All @@ -163,7 +159,7 @@ def post(self, *args, **kwargs):
def get_script_inject(self):
service_uuid = self.kwargs.get("service_uuid")
script_inject = cache.get(f"script_inject_{service_uuid}")
if script_inject is None:
if script_inject == None:
service = Service.objects.get(uuid=service_uuid)
script_inject = service.script_inject
cache.set(f"script_inject_{service_uuid}", script_inject, timeout=3600)
Expand Down
Loading