Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Capture investigation referral data #162

Merged

Conversation

nathanbegbie
Copy link
Contributor

No description provided.

- add redirect view to capture investigation UUID
- add middleware to track user behaviour
@nathanbegbie nathanbegbie force-pushed the feature/issue-162-capture-investigation-referral-data branch from 27de636 to e28e4fb Compare May 28, 2018 13:31
Request and response objects are not JSON serializable, and a single DB write doesn't  seem worth it to use Celery
@nathanbegbie nathanbegbie force-pushed the feature/issue-162-capture-investigation-referral-data branch 2 times, most recently from bd875e2 to 12737d2 Compare May 28, 2018 14:01
method = models.TextField(null=True)
title = models.TextField(null=True)
visitor_uuid = models.TextField(null=True)
user_profile_uuid = models.TextField(null=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have null=True for TextFields? We usually only want blank=True, so that we only have one way of representing a null value in the database.


visitor_uuid = request.COOKIES.get('visitor_uuid', False)
if not visitor_uuid:
response.set_cookie('visitor_uuid', str(uuid.uuid4()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that we can also use the request session to store this UUID, or just use the session ID, instead of dealing with cookies ourselves.

exclude = [p for p in settings.ANALYTICS_IGNORE_PATH
if request.path.startswith(p)]
return any(exclude)
return False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also include page views for people who didn't go through the analytics endpoint. Just want to make sure that that is the desired functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was intended

@nathanbegbie nathanbegbie force-pushed the feature/issue-162-capture-investigation-referral-data branch from 12737d2 to afc7d0f Compare May 28, 2018 14:18
session ID is only recorded after this layer of middleware, hence the need for a new UUID
nurseconnect makes AJAX calls to menu on every page load for some reason request.is_ajax fails to pick this up in middleware
@nathanbegbie nathanbegbie merged commit 847b67e into develop May 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants