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

Fix visit tracking and add locking for storing data #104

Merged
merged 1 commit into from
Dec 31, 2020

Conversation

sharon-wang
Copy link
Member

Fixes: #101

Visit tracking was broken for sites that have delayed monetization events, such as adapted sites like YouTube and sites that enable monetization via iframes.

Now, we register a visit in originStats for every page visited and only increment the originData monetized visits once we know that the site is monetized.

In collaboration with @vezwork, locking has been added for storing data. During my testing, I noticed that data was getting overwritten, since many asynchronous requests to store to browser storage can occur at the same time. To ensure that data stores do not run over each other, locking around the data storing is needed so that writing to local browser storage occurs sequentially.

Even with this locking addition, we think there might be some errors with storing between tab switches. This is because saving data to browser storage is happening on a per-origin basis, but the data being stored is to the same place in browser storage, so there may be issues with losing/overwriting data. Opened #103 to start discussion about this.

Copy link
Member

@vezwork vezwork left a comment

Choose a reason for hiding this comment

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

lgtm!

@vezwork
Copy link
Member

vezwork commented Dec 31, 2020

Tested and everything looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Visits to pages with delayed monetization don't count as monetized visits
2 participants