Navigation Menu

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

Disallow event tracking with empty/whitespace categories #11819

Merged
merged 6 commits into from Jun 26, 2017
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jun 26, 2017

fixes #11623

@sgiehl sgiehl added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Jun 26, 2017
@sgiehl sgiehl added this to the 3.0.5 milestone Jun 26, 2017
js/piwik.js Outdated
@@ -4957,7 +4957,7 @@ if (typeof window.Piwik !== 'object') {
function logEvent(category, action, name, value, customData, callback)
{
// Category and Action are required parameters
if (String(category).length === 0 || String(action).length === 0) {
if (this.trim(String(category)).length === 0 || this.trim(String(action)).length === 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This should prevent requests being sent with whitespaced category or action

Copy link
Member

Choose a reason for hiding this comment

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

Should we log an error to the console in this case?

@@ -53,7 +53,7 @@ public static function updateActionsTableWithRowQuery($query, $fieldQueried, & $
unset($row[PiwikMetrics::INDEX_SITE_SEARCH_HAS_NO_RESULT]);
}

if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT))) {
if (in_array($row['type'], array(Action::TYPE_CONTENT, Action::TYPE_EVENT, Action::TYPE_EVENT_NAME))) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This should fix the failing archiving for already tracked empty categories.

@tsteur
Copy link
Member

tsteur commented Jun 26, 2017

Looks good to me. To be defined if we log an error or not in tracker.

@sgiehl
Copy link
Member Author

sgiehl commented Jun 26, 2017

As this case seems currently to be the only case where we "actively" discard an tracking request guess logging an error wouldn't be bad. Updated the PR :)

@tsteur
Copy link
Member

tsteur commented Jun 26, 2017

LGTM if tests pass

@sgiehl
Copy link
Member Author

sgiehl commented Jun 26, 2017

Build failure seems not to be related to this changes

@sgiehl sgiehl merged commit 1d5bbb5 into 3.x-dev Jun 26, 2017
@sgiehl sgiehl deleted the eventtracking branch June 26, 2017 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Action table for type '12' was not found during Actions archiving
2 participants