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

WIP: Implement tracking of page title #251

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

jujoko7CF
Copy link
Contributor

User has a feature request to show the page title instead of just the target url. After some long discussions we decided to introduce a new statify meta table. In this table any additional tracking data can be saved. With this PR we save the wp_document_title in this meta table.

Fixes #78 , #196

This column will be used for aggregation and is filled with 1 initially.
The number of hits for a specific date/target/referrer is thus no longer
the number of entries, but the sum of all hits.
We now aggregate statistics data in the cleanup routine preserving
only distinct entries for each date/referrer/target combination with
the sum of all hits.
If Statify is extended by custom columns the aggregation routine will
fail. To support such scenarios, we introduce a boolean hook, so the
previous behavior can be preserved without breaking compatibility.
@jujoko7CF jujoko7CF marked this pull request as draft March 19, 2023 20:49
@2ndkauboy 2ndkauboy added this to the 2.0.0 milestone Mar 19, 2023

$meta_value = call_user_func( $sanitize_function, $meta_value );

/* Init rows */
Copy link
Member

Choose a reason for hiding this comment

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

Single line comments should not use block comments.

}
}

/* neue option: db Version 2.0.0 */
Copy link
Member

Choose a reason for hiding this comment

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

Remove this comment.

@jujoko7CF jujoko7CF force-pushed the feature/78-post-title-instead-permalink branch from 48a5137 to f800357 Compare March 20, 2023 11:39
*
* @var string[]
*/
public static $tables = array(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should not be public and/or constant?

Copy link
Contributor

Choose a reason for hiding this comment

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

Const array is PHP 5.6+ iirc (currently supported 5.3+)
But feel free to raise the requirements, if that make things easier here.

Copy link
Member

@2ndkauboy 2ndkauboy Mar 20, 2023

Choose a reason for hiding this comment

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

Constant arrays is not a thing at all 😆 Like not before PHP 7+, so we just make it private.

@stklcode
Copy link
Contributor

Just a reminder that this change conflicts with the planned aggregation (#234) or at least requires significant changes on at least one side.

@jujoko7CF jujoko7CF force-pushed the feature/78-post-title-instead-permalink branch from f800357 to 8df7cd1 Compare March 20, 2023 17:53
@2ndkauboy
Copy link
Member

@stklcode it is true that this might conflict with the data aggregation. But not necessarily. We haved discussed the data aggregation being in conflict with multiple other issues and have to yet decided if, and how the data aggregation would be done. We could still have aggregated data while still collecting more information. We "only" need to decide "at aggregation" how to handle this aggregated data. Would we aggregate per unique touple, use just one (the latest) additional data set? This should then be discussed in the data aggregation ticket.

@stklcode
Copy link
Contributor

I didn’t say that aggregation is impossible with additional metadata, just not in the currently proposed way, i.e. we cannot simply merge both without additional work.

The title typically has 1-to-1 relation with the target URL at at specific point in time, so this case is more or less trivial to solve. With more attributes combinations grow and the benefits of tuple aggregation is thus reduced, so multi-layer aggregation over each attribute may be worth thinking of. But this would be incompatible with the proposed data structure.

But all this might be overthought at this time, we should not make it more complex than necessary for the first shot.

@2ndkauboy 2ndkauboy force-pushed the feature/78-post-title-instead-permalink branch from 8df7cd1 to 210a515 Compare March 26, 2023 14:45
@sonarcloud
Copy link

sonarcloud bot commented Apr 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
1.1% 1.1% Duplication

@stklcode stklcode force-pushed the feature/78-post-title-instead-permalink branch 2 times, most recently from 0d94eac to e3d991a Compare October 18, 2023 09:45
@jujoko7CF jujoko7CF force-pushed the feature/78-post-title-instead-permalink branch from 0d94eac to e3d991a Compare October 18, 2023 10:04
@sonarcloud
Copy link

sonarcloud bot commented Oct 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

No Coverage information No Coverage information
0.6% 0.6% Duplication

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.

Optimizing creation/config of SQL tables Show title instead of permalink
3 participants