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

Segmentation: implement UI for adding/editing segments, and switching segments #2135

Closed
mattab opened this issue Mar 4, 2011 · 43 comments
Closed
Assignees
Labels
Critical Indicates the severity of an issue is very critical and the issue has a very high priority. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Mar 4, 2011

Piwik now support full segmentation via the API only: http://piwik.org/docs/analytics-api/segmentation/

We want to be able to

  • Create segments
    • define the conditions AND / OR
    • pick metric
    • pick match (equals, contains, etc.)
    • pick value
    • give the segment a name
    • Segment is created inside the "report" UI like Goals
  • Test Segment in real time (fetch number of visits for it). Just calls the API with segment='' and fetches number of visits.
  • Edit segment: UI page resets to current segment definition
  • Build the feature to autocomplete when filling a value for a given dimension/metric, for efficiency and ease of use. Reuse the code in getLabelsFromTable()
  • For metrics, when the value in the filter is not numeric, throw an error

Also, when creating a segment, you can add check 2 boxes

  • Add to my segment list (checked by default - available only to user who creates it)
  • Add to this website segment list (viewable by all & editable by all users with admin on this site)
  • For super user, "Add this to all websites segment list".
    Segment definitions are stored in a new 'segment' table, which contains the creator user login, idsites the segment appears in.
    In the super user case, the segment will have a flag "idsites" = "all".
  • Archive.php: update to pre-process segments created for a particular website. call API to get per-site segments. Let user disable this with config setting.

In the Reporting UI, there would be a new box probaby similar to current Calendar / Info box that would list the current Segment applied to the data.
It would open up (similarly to the calendar) to show the list of pre-created segments, or the "Add a new segment" link.

User can then click on the Segment link to ajax reload the report with the segment applied to all visible reports.

The list of segment will lists all Websites segment first, then all User segments.

Note: some of the UI logic to define segment can be similar to the one used to define custom alerts (#1486), in particular the "value" ajax suggestion would reuse the same code.

GA supports visitsToTransaction and daysToTransaction - is it equivalent to "visitConverted==1;daysSinceFirstVisit==X" ? maybe not

Summary: the UI will allow to create/edit/delete segments, we will add a new box next to the calendar to select currently applied segments.

BUGS to fix
At the same time, it would be nice:

Later version
In the V1, we will not compare the Segment data with the "All visits" data or allow to compare segments together. This feature would be very nice and is important to have, see also ticket to compare several date ranges #291

Requirements

I will ask Marcin to provide some mockups for the screens of this feature. Once we have them we can implement this new UI element.

Please post here any idea/feedback!

@robocoder
Copy link
Contributor

See also #2092

@anonymous-matomo-user
Copy link

I'm wondering what that status of this feature is. It looks like you folks have been recently active on it.

The reason I ask is because I have need of segmentation in a 3rd party plugin I'm using/developing. I was just going to hack something together, but if you are far along I'd rather do it correctly.

@mattab
Copy link
Member Author

mattab commented May 9, 2011

No work has been done on the "UI to create Segment picker" but the backend of analytics segmentation works

See also: http://help.yandex.com/metrika/?id=1122004

@anonymous-matomo-user
Copy link

I noticed in the Archive.php docs that you can set a segment. Is the segment archiving functional? It would be great to be able to use that

[http://qa.piwik.org:8080/phpdocs/Piwik/Piwik_Archive/Piwik_Archive.html#setSegment]

@mattab
Copy link
Member Author

mattab commented Aug 17, 2011

As per report in: http://forum.piwik.org/read.php?2,80293

there is a few issues when a segment is passed to the request with regards to graphs.

@mattab
Copy link
Member Author

mattab commented Sep 11, 2011

Once this is implemented, a typical workflow could be:

  • Go to Visitors > Custom Variables report
  • create/select Segment: visits who looked at page
  • Click "apply"
  • Custom variables report now reports only for users who have seen a given page

@mattab
Copy link
Member Author

mattab commented Sep 17, 2011

I really want to work on this feature so increasing priority as personal reminder :)

@mattab
Copy link
Member Author

mattab commented Sep 17, 2011

When implementing Segmentation UI, let's think about Visitor Log. A Frequently requested feature is to be able to "filter" the visitor log to specific countries, pages, actions, IPs, hostnames, etc. See #1839

Maybe this UI can be reused also as a real time filter UI for the Visitor Log. The backend is the same code anyway: creating a segment then applied to the Live! APIs.

See also this post

This would be great to implement both features at once!

@mattab
Copy link
Member Author

mattab commented Nov 18, 2011

  • add support for Segmentation for Scheduled reports. For example, a new line in the Report editor would allow to generate and email the scheduled report (pdf or html) for a given segment, including all selected reports.
  • Segment creator / edit
    • Sharing / reusing segments
    • "( ) Share this segment with all users." - Only available to super user.
    • "( ) Share this segment with specific users
    • When a segment is applied to the report, the Segment edit would have a checkbox "By default, load Piwik reports filtered to '$NAME' instead of 'All Visits'".
    • because segment name is going to be used a lot in reports, UI, etc. we should let users know what type of name is expected. It would be used also in report footer see Allow to plot custom variable values (or any rows) by searching & plotting - JS Graphs #2786
  • The segment selector could display first
    • Segments last used for this website
    • Most used across websites
    • top 10 common pre-selected by Piwik
    • Inline search box

Some ideas for pre-created segments:

  • Customers
    A segment that includes only visits from existing customers even if they do not purchase from your site when they visit. This is why this segment is so valuable these visitor have bought from you before!
  • Engagers
    After customers, Engagers are your next most valuable group of visitors. They have shown engagement, i.e., made an effort, perhaps even given you their contact details. Examples include registrations, contact requests (form submissions), file downloads, ranking products and content, comments and feedback, video views, clicks on social love buttons etc.
  • Mobilers
    A segment that includes only visits from mobile devices. Mobile is a very different experience to browsing on a bigger screen. Lots of implication for your web site structure/design if this segment is significant to you.
  • Non-Bouncers
    A segment that excludes all bounced visits i.e., removes single page visits that have no engagement. The theory is that these visitors are clearly not interested in your website, so remove them from your analysis.

See cmswire.com/cms/customer-experience/interview-brian-clifton-on-cutting-through-data-noise-and-the-future-of-analytics-017510.php

See also support.google.com/analytics/bin/answer.py?hl=en&answer=1011783

http://searchenginewatch.com/article/2268458/16-Secret-Google-Analytics-Advanced-Segments-Worth-Their-Weight-in-Gold

@mattab
Copy link
Member Author

mattab commented Nov 3, 2012

As part of #3088 we should allow Scheduled reports to be sent with a specific segment applied. The API should accept either False, a segment ID, or a new segment string specific to this report. Reported in forums

@mattab
Copy link
Member Author

mattab commented Nov 3, 2012

As reported in #3507 Visitors Log under Visitors tab - it would be nice if we could filter
by:

IP address
Goal (show only visits that achieved a specific goal)
Referrer URL
Keyword
Campaign (Show only visitors from a specific Campaign)
visited page (URL)
Action String (search the "action" column for specific string, p.e. "*product-name*") 

This is the link to the forum request:
http://forum.piwik.org/read.php?3,88704

@anonymous-matomo-user
Copy link

It would also be nice if the visitor log could be filtered by 'Provider.' At current, I have to grep through my logs for the provider name, and then compare it to the Apache logs to see what pages the visitors viewed.

Cheers,
Nathan Zachary

@mattab
Copy link
Member Author

mattab commented Nov 13, 2012

We are officially calling for sponsors for funding for this feature! We would love to implement this feature in Piwik. If you can help sponsor even just a few hours of work, we hope to crowdfund and find many more. Contact us now to get started and help make this feature possible!

See also #3095

@anonymous-matomo-user
Copy link

Replying to matt:

We are officially calling for sponsors for funding for this feature! We would love to implement this feature in Piwik. If you can help sponsor even just a few hours of work, we hope to crowdfund and find many more. Contact us now to get started and help make this feature possible!

I am very interested in this feature, and also like to participate implementation.

@mattab
Copy link
Member Author

mattab commented Mar 11, 2013

we reached the crowdfunding goal, awesome!! http://crowdfunding.piwik.org/custom-segments-editor/

Note, to fix at the same time: #3639

  • each segment can be
    • "Use only today" (default)
    • "Saved to use later (and pre-process every night)"
      When "Use only today" the segmented data will be deleted after 1 day.

See also:

@mattab
Copy link
Member Author

mattab commented Apr 23, 2013

In 7933de1: Refs #2135

  • BETA release of Segment editor.
  • API to add/update/delete/get recorded segments
  • cron script will pre-process segments marked as such
  • UI to create, update, apply segments

TODOs @mattab

  • test with NON super user (anon/view/admin)
  • testing (and more testing)-- try to break it (it's not hard...)
  • UI: Saving the segment for reuse / pre-processing
  • Loading message: "This can take a while based on the amount of data that needs to be pre-archived"
  • i18n
  • Save & Apply this segment ==> "Test this segment" which would call VisitsSummary.get for early feedback ?
  • hoping for Piotr superJS Ninjas skills with some jquery/js that I can't figure out

@mattab
Copy link
Member Author

mattab commented Apr 23, 2013

In b5067e0: Refs #2135
Reverting some reformat code that went wrong (as Jquery 1.9 expects HTML strings to start with < rather than a space followed by <

@mattab
Copy link
Member Author

mattab commented Apr 24, 2013

In 0f3d976: Refs #2135 Few JS fixes for a cleaner UI/UX

@mattab
Copy link
Member Author

mattab commented Apr 24, 2013

In 304a03e: Refs #2135 forgot to to check these in

@mattab
Copy link
Member Author

mattab commented Apr 25, 2013

In 85a30e3: Refs #2135

  • Adding auto suggest listing
  • Fixing remaining JS bugs

Kuddos Michal & Piotr for your help!

@mattab
Copy link
Member Author

mattab commented Apr 25, 2013

In 3212ef6: Refs #2135

  • Adding latest version of mousewheel
  • fixing line endings (why do I always have to do this, somehow it reverts itself...)
  • Fixing css bugs (they required the DOCTYPE to be changed, MAYBE THIS WILL BREAK SOMETHING? I wonder why we haven't changed the DOCTYPE before?)

OMG this is starting to be awesome!

@mattab
Copy link
Member Author

mattab commented Apr 25, 2013

In b4c5661: Showing suggested value on click on the INPUT field Refs #2135

@peterbo
Copy link
Contributor

peterbo commented May 2, 2013

Here is a little feedback on a short testing period of this fantastic feature:

  • Segments not created by the superuser trigger a login screen in the dashboard widgets, saying that you need at least superuser rights to access this resource (This is listed in your TODO, so I think you're aware of this one)
  • as superuser, when you are viewing a segment and change to another segment, the first selected segment stays applied (even when you switch back to "all visits (default)"). This is not the case when you view a segment in admin or user permission mode.
  • when you edit an existing segment, blanks and other special chanracters are urlencoded (e.g. "%20")
  • The "Delete" a segment function does not seem to work. There seems to be an error while triggering the "are you sure" modal dialog

Features

  • Would it make sense to include the segments selector in the "all websites" overview? A user could be able to apply a segment which was created for "all websites".
  • A warning or a notice that the processing of a new / not yet archived segment can be slow.
  • A user should be able to only create and "save" a segment and not apply it yet to the reports. If you want to create a bunch of segments, "save & apply" could be really slow and disturb the workflow.
  • Later: a feature for "cloning" a segment could be nice. If you have a complex segment and you only want to change a few details, this feature would be quite handy.

@mattab
Copy link
Member Author

mattab commented May 12, 2013

In 028342a: Refs #2135

  • Fixing some encoding issues and many small bugs
  • When user is anonymous, show message inviting user to login to try the feature

@mattab
Copy link
Member Author

mattab commented May 12, 2013

In 263892f: Refs #2135

@mattab
Copy link
Member Author

mattab commented May 12, 2013

In d89a08b: Fixes #3932

Refs #2135

  • fixing last bugs with segment selector encoding (working on chrome + FF + opera) - I 'hope' it will work on iE...

@mattab
Copy link
Member Author

mattab commented May 12, 2013

Replying to peterb:

Here is a little feedback on a short testing period of this fantastic feature:

  • Segments not created by the superuser trigger a login screen in the dashboard widgets, saying that you need at least superuser rights to access this resource (This is listed in your TODO, so I think you're aware of this one)
  • as superuser, when you are viewing a segment and change to another segment, the first selected segment stays applied (even when you switch back to "all visits (default)"). This is not the case when you view a segment in admin or user permission mode.
  • when you edit an existing segment, blanks and other special chanracters are urlencoded (e.g. "%20")
  • The "Delete" a segment function does not seem to work. There seems to be an error while triggering the "are you sure" modal dialog

Hey Peter, thanks for testing! Could you check again, these should now be fixed!

@mattab
Copy link
Member Author

mattab commented May 12, 2013

Replying to peterb:

Here is a little feedback on a short testing period of this fantastic feature:

Thanks for suggestions. I will implement the "Warning/notice message" but I moved the rest to a "feature request" ticket: #3934

@mattab
Copy link
Member Author

mattab commented May 14, 2013

In 10deaac: Refs #2135
Fixing couple small bugs

@mattab
Copy link
Member Author

mattab commented May 15, 2013

In 2527216: Refs #2135 i18n + improvements (custom loading message when segment applied)

@mattab
Copy link
Member Author

mattab commented May 17, 2013

In 047412d: Refs #2135
* Not forwarding segment parameter to the top menu links

Note: ideally we should display the Segment Editor on the WIDGET and API pages refs #3934

@mattab
Copy link
Member Author

mattab commented May 23, 2013

In 13ba840: Fixing non working footer link refs #2135

@mattab
Copy link
Member Author

mattab commented May 23, 2013

I think the code is now complete. Please post here any suggestion or bugs you find. I will also add user documentation separately. Thanks for testing & all the best enjoying this feature and finding new insights!

@mattab
Copy link
Member Author

mattab commented May 25, 2013

In 2187780: Refs #2135 fixing CSS/image which wasnt big enough for German button label

@mattab
Copy link
Member Author

mattab commented May 27, 2013

Replying to nathanzachary:

It would also be nice if the visitor log could be filtered by 'Provider.' At current, I have to grep through my logs for the provider name, and then compare it to the Apache logs to see what pages the visitors viewed.

Cheers,
Nathan Zachary

Btw this is now possible since Benaka fixed Provider support in: 9824c49

Grab yourself the 1.12-b22 and enjoy!

@mattab mattab added this to the 1.12 - The Great 1.x Backlog milestone Jul 8, 2014
@mattab mattab self-assigned this Jul 8, 2014
This was referenced Nov 14, 2011
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical Indicates the severity of an issue is very critical and the issue has a very high priority. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

5 participants