This repository has been archived by the owner on Nov 11, 2018. It is now read-only.
feat(counting): refactor the way counting works #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation increases the number of visits for a domain if
from=outside
firstvisit=true
This is not how we want to count visits to .HIV domains.
We want to count every visit to a .HIV domain within a configurable threshold between consecutive visits.
As we are currently not storing user state in the backend we require clients (the banners) to send information about recurring users. In order to be flexible about the threshold and adapt our counting backend in the feature without needing to change the request the following changes have been made to the request:
ct
, e.g.ct=1397341234000
pt
, e.g.ct=1397340001000
. If it cannot be determined they must send an empty value:pt=
. Clients should use cookies with a lifetime of 30 days to track the last visit.For simplicity timestamps are expressed as integers (unix timestamps in microseconds) in the users timezone.
If the previous timestamp is present, we calculate the diff in seconds and if it is greater than the configured threashhold, we count a click. If the previous timestamp is not present we count a click.
The new format makes request parameters absolut thus enabling us in the future to drop already applied request or enable throttling mechanisms based on the time.