Improve ingress location handling

This commit is contained in:
R. Miles McCain 2020-04-15 18:01:26 -04:00
parent 29c0d6e078
commit c620342b42
No known key found for this signature in database
GPG Key ID: 91CB47BDDF2671A5
2 changed files with 5 additions and 1 deletions

View File

@ -122,7 +122,10 @@ def ingress_request(
session=session, session=session,
initial=initial, initial=initial,
tracker=tracker, tracker=tracker,
location=location, # At first, location is given by the HTTP referrer. Some browsers
# will send the source of the script, however, so we allow JS payloads
# to include the location.
location=payload.get("location", location),
referrer=payload.get("referrer", ""), referrer=payload.get("referrer", ""),
load_time=payload.get("loadTime"), load_time=payload.get("loadTime"),
) )

View File

@ -16,6 +16,7 @@ window.onload = function () {
JSON.stringify({ JSON.stringify({
idempotency: idempotency, idempotency: idempotency,
referrer: document.referrer, referrer: document.referrer,
location: window.location.href,
loadTime: loadTime:
window.performance.timing.domContentLoadedEventEnd - window.performance.timing.domContentLoadedEventEnd -
window.performance.timing.navigationStart, window.performance.timing.navigationStart,