-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Display unique campaign views instead of overall views #680
Conversation
I'll test this locally on a large DB soon and then merge. |
I tested this on a DB with tens of millions of rows and it's fast. So,
However, there's a side-effect here. The distinct query is only meaningful when |
I think we should merge this PR/add this feature. You mentioned a good point about individual subscriber tracking. I am personally on a privacy friendly side. However what is the point, if the graphics are totally useless (they are) if no individual people are tracked. Maybe it would make sense to USE or NOT TO USE the tracking at all. Is that maybe a more user friendly experience idea? |
I disagree. With individual tracking off, the PR renders a flat graph. There are thousands of actual views recorded (without individual subscriber information), including duplicate views, granted, but it is still valid information. To show 0 in such cases is semantically incorrect. I think the better approach is to show unique views (like this PR does) when individual views are turned on, and non-unique views when they're off. This non-unique graph, despite including an unknown number of duplicates, still conveys some useful information on trends. I'll hold off on this PR and push a patch that does unique/non-unique conditionally based on the privacy setting. It'll need the existing SQL queries to have string interpolation based on the privacy setting (there's no way to do a conditional DISTINCT directly) so requires a bit more work. |
But then the UI should also reflect this and should not show any percent, like it does at the moment. |
Yep, when subscriber tracking is off and the graph's non-unique, the % dials will not render. |
5eb855f
to
dc82bcc
Compare
Maybe instead of creating a string interpolation query, just fetch both of these values. I'm not sure though how this affects the performance.
After that (depending on tracking settings) one of these counts could be returned to REST endpoint. |
@marcinkunert 2614b07 addresses this. The queries are string interpolated based on the privacy setting just once and are prepared and kept on app boot. Having 4 big queries and executing them in app logic would've been complicated. |
@knadh sure, looks good! |
I haven't tested it on a huge database, but it should do the trick. As far as I know, no other changes should be required.
Closes #676