-
Notifications
You must be signed in to change notification settings - Fork 3
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
Track monetized and non-monetized time properly #98
Track monetized and non-monetized time properly #98
Conversation
I've tested this with the Coil extension installed and I'm seeing the correct outcome. Test steps
|
Also a note that you may need to install Akita from scratch again, since the data storage has changed. You might see weird behaviour in the UI otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to test locally now. I have one question:
Currently you are counting any time on a page containing a monetization tag as monetized. I'm wondering what your thoughts are on instead not counting time as monetized until after the cachedPaymentPointer is validated? Then the monetized time would match more closely with the amount of time you see the monetized Akita extension icon, and invalid payment pointers would not count for monetized time.
The cachedPaymentPointer would have already been validated 1 second prior (previous setInterval iteration). We could move setting |
There is no garantee that the cachedPaymentPointer has been validated. For example: if
I think something along these lines could work but my suggestion would be just to change line 145 to const isMonetizedTime = cachedPaymentPointer !== null && await isPaymentPointerRecentlyValidated(cachedPaymentPointer); This should work, noting that time before the payment pointer is validated is not counted as monetized time even after the payment pointer is validated. I think this is reasonable since it is necessary to validate a payment pointer before monetization starts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new changes to storeDataIntoAkitaFormat
/storeDataIntoAkitaFormatNonMonetized
fixes the issue in #98 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice changes, I would say they improve the code quality and are clear. Just one issue about repeated validations otherwise this looks great.
Just did some more testing and everything is working great :) |
86bbb46
to
b2d21c4
Compare
Thanks for the changes, looks great! Please squash and merge. |
Previously, we assumed that as soon as we see a payment pointer on a website (at an origin), that the origin is always considered to be monetized. So, once we decided that an origin is monetized, any time spent on the site was considered monetized time spent on the site. However, this is a flawed assumption, since sites such as YouTube may only contain payment pointers (meta tags) on specific videos and not others. So, some of the time spent on the site is monetized and some is non-monetized. This PR updates how we track time by checking for a payment pointer as we track time, to store time spent properly. We no longer store detailed data for every single origin -- only monetized origins are stored. Additionally, counting monetized visits and associated functions have been removed as they were not being used or were redundant. The `isCurrentlyMonetized` field has been removed from AkitaOriginData as it was a major part of the problematic monetized time tracking. The text in the top site detail has been updated to point out that the time is monetized time, just to be clear. Signed-off-by: sharon-wang <[email protected]>
44ce246
to
59b1b4e
Compare
Fixes: #79
Previously, we assumed that as soon as we see a payment pointer on a website (at an origin), that the origin is always considered to be monetized. So, once we decided that an origin is monetized, any time spent on the site was considered monetized time spent on the site. However, this is a flawed assumption, since sites such as YouTube may only contain payment pointers (meta tags) on specific videos and not others. So, some of the time spent on the site is monetized and some is non-monetized. This PR updates how we track time by checking for a payment pointer as we track time, to store
time spent properly.
We no longer store detailed data for every single origin -- only monetized origins are stored. Additionally, counting monetized
visits and associated functions have been removed as they were not being used or were redundant. The
isCurrentlyMonetized
field has been removed from AkitaOriginData as it was a major part of the problematic monetized time tracking. The text in the top site detail has been updated to point out that the time is monetized time, just to be clear.