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

New Goal type: Convert when user stays more than X minutes on the site #14508

Merged
merged 12 commits into from Jul 11, 2019

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Jun 3, 2019

This PR adds the following types of goals:

  • goals based on visit duration

@diosmosis diosmosis added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review labels Jun 3, 2019
@diosmosis diosmosis added this to the 3.11.0 milestone Jun 3, 2019
core/Tracker/GoalManager.php Outdated Show resolved Hide resolved
core/Tracker/GoalManager.php Outdated Show resolved Hide resolved
@tsteur
Copy link
Member

tsteur commented Jun 3, 2019

Is there an issue for this?

@diosmosis
Copy link
Member Author

Is there an issue for this?

Not that I could find, though matt thought there was one, I noticed the discrepancy when working on the GA importer. There are goal types we won't be able to import. It didn't seem like a complicated change.

GA provides 'visit duration' goals + 'total number of pages viewed'. They also allow matching on multiple event attributes, but that seems like a more complicated addition.

@diosmosis diosmosis changed the title New goal types to match goals in GA New goal type to match one goal type in GA Jun 4, 2019
{
if (empty($patternType)) {
return '';
}

$patternType = strtolower($patternType);

$validator = new WhitelistedValue(['exact', 'contains', 'regex']);
if (in_array($matchAttribute, GoalManager::$NUMERIC_MATCH_ATTRIBUTES)) {
$validValues = ['>'];
Copy link
Member

Choose a reason for hiding this comment

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

not sure, should we maybe use greater_than or so?

Copy link
Member

Choose a reason for hiding this comment

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

I think we do this in some other places.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's a limit on the field size, I think 'greater_than' was a little too long. Didn't want to create a db upgrade for something so small, but I can if it's better.

Copy link
Member

Choose a reason for hiding this comment

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

it's fine to have an update for it as it's not a log table.

@tsteur
Copy link
Member

tsteur commented Jun 7, 2019

image

is it possible to not show "case insensitive" for numeric goals? And maybe ideally pattern would show "in seconds" or so. Because the example says minutes but I reckon the number we enter is in seconds?

@tsteur
Copy link
Member

tsteur commented Jun 7, 2019

image

maybe the colon could go "in triggered when" column and it could say "greater than" as not everyone would understand >?

@tsteur
Copy link
Member

tsteur commented Jun 7, 2019

Seems to work otherwise in general 👍 . Only now seeing we enter the visit duration in minutes, should it be seconds maybe? just to be a bit more flexible... although I don't think anyone would want to trigger a goal after a few seconds... so minutes should be fine.

@mattab
Copy link
Member

mattab commented Jun 30, 2019

Seems to work otherwise in general +1 . Only now seeing we enter the visit duration in minutes, should it be seconds maybe? just to be a bit more flexible... although I don't think anyone would want to trigger a goal after a few seconds... so minutes should be fine.

Minutes should be better I reckon, but maybe allow for less than 1 minutes, or in general decimal minutes (1.5, 5.5, etc) so it's flexible (didn't check if maybe this already works)

@diosmosis
Copy link
Member Author

@mattab Updated so it would allow floating point values for minutes (test should reflect this).

@tsteur Applied review fixes

@mattab
Copy link
Member

mattab commented Jul 3, 2019

Feedback:

  • Change Pattern to Time in minutes
  • In inline help, explain the tip that one can specify time in seconds for example 30 seconds by writing 0.5 in the field.
  • Does Allow multiple conversions per visit make sense for this new goal type? reckon it does not and could be removed. (This type of Goal would only be converted once per visit always?)
  • In the Manage goals it says visit_duration \n Pattern greater_than: 5 -> can we change it to Visit duration greater than 5 minutes
  • UI tests need updates
  • The user guide https://matomo.org/docs/tracking-goals-web-analytics/ will need updated

Looking forward to merging this so we can start beta testing our Google Analytics importer 🚀 🚀

@mattab mattab self-requested a review July 4, 2019 00:02
@diosmosis
Copy link
Member Author

@mattab updated everything except screenshot test update

@mattab
Copy link
Member

mattab commented Jul 11, 2019

Looks great & works! 👍

@diosmosis Be great if you could also edit the user guide at https://matomo.org/docs/tracking-goals-web-analytics/ and mention this new goal type and feature.

(just added it now to: https://matomo.org/features)

@diosmosis
Copy link
Member Author

@mattab

Be great if you could also edit the user guide at https://matomo.org/docs/tracking-goals-web-analytics/ and mention this new goal type and feature.

Updated.

@diosmosis diosmosis merged commit f0c53c4 into 3.x-dev Jul 11, 2019
@diosmosis diosmosis deleted the ga-goal-types branch July 11, 2019 20:33
@mattab mattab changed the title New goal type to match one goal type in GA New Goal type: Convert when user stays more than X minutes on the site Jul 23, 2019
@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants