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

Customizeable / Extendable Visitor Profile & Visitor Log #11579

Merged
merged 112 commits into from
Sep 4, 2017
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Apr 3, 2017

Proposed changes to the way how visitor log and profile are created:

Introduces new classes (named VisitorDetails) that can be implemented in every plugin.
With this classes the visitor and action data used for the Live plugin can be provided, filtered and manipulated. Additionally the classes can define extra content to be rendered in visitor log & profile

Additional changes / improvements

fixes #6111
refs #9507

layout changes also fixes #11589

@sgiehl sgiehl added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Apr 3, 2017
@sgiehl sgiehl added this to the 3.0.3 milestone Apr 3, 2017
@mattab mattab modified the milestones: 3.0.3, 3.0.4 Apr 3, 2017
@sgiehl sgiehl force-pushed the visitordetails branch 6 times, most recently from d37d772 to b34f7fc Compare April 10, 2017 07:54
@sgiehl sgiehl force-pushed the visitordetails branch 4 times, most recently from 9505fa3 to 393c88e Compare April 20, 2017 19:47
@tsteur
Copy link
Member

tsteur commented May 4, 2017

FYI: An issue I ran a few times into when extending the visitor logs eg via event or so is that most of the events are methods / hooks are triggered per visitor. When showing like 250 or up to 500 visits on one page, we might do 500 times a SQL query for each plugin that hooks into. For example plugins would check if there is a custom dimension, or media views, form interactions, recorded sessions, etc. They are all in different tables etc and query per visitor.

It would be great if there was like an event or method / hook that gives you the row of visitors so it is more efficiently possible to fetch in one query the data (eg using idvisit in (....)) instead of having heaps of individual queries, then render it later individually. I haven't looked much into PR or the other PRs if something like this is already implemented but be good to have.

log_link_visit_action.interaction_position
" . $sqlCustomVariables . ",
log_action_event_category.name AS eventCategory,
log_action_event_action.name as eventAction
Copy link
Member

Choose a reason for hiding this comment

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

FYI: Not needed for now but eventually we also need to fetch log_link_visit_action.idpageview as other plugins will likely hook into individual actions based on the idpageview. I will add this likely once needed

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add log_link_visit_action.idpageview

@sgiehl sgiehl force-pushed the visitordetails branch 2 times, most recently from 71e882c to aa12678 Compare May 8, 2017 08:40
CHANGELOG.md Outdated
@@ -18,6 +18,7 @@ The Product Changelog at **[piwik.org/changelog](http://piwik.org/changelog)** l
### Breaking Changes
* New config setting `enable_plugin_upload` lets you enable uploading and installing a Piwik plugin ZIP file by a Super User. This used to be enabled by default, but it is now disabled by default now for security reasons.
* New Report class property `Report::$supportsFlatten` lets you define if a report supports flattening (defaults to `true`). If set to `false` it will also set `ViewDataTable\Config::$show_flatten_table` to `false`
* The event `Live.getAllVisitorDetails` has been deprecated and will be removed in Piwik 4. Use a `VisitorDetails` class instead (see Live plugin).
Copy link
Member

Choose a reason for hiding this comment

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

  • Let's add a test for this deprecation in tests/PHPUnit/Unit/DeprecatedMethodsTest.php

Copy link
Member Author

Choose a reason for hiding this comment

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

How to test a deprecated Event? Did we do that for other Events before?

Copy link
Member

Choose a reason for hiding this comment

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

probably we can't do this. So maybe we just create an issue in Piwik 4 milestone instead?

@mattab
Copy link
Member

mattab commented May 9, 2017

This looks promising 👍

  • What are your thoughts regarding Thomas comment on performance?
  • if possible, It would be great to include in this PR the refactoring of all template code into relevant plugins. This could validate the new APIs and finalise the project.

We might need to move this into 3.1.0 release as I assume it won't be finished in time for 3.0.4?

@mattab mattab modified the milestones: 3.0.4, 3.0.5 May 9, 2017
@sgiehl sgiehl force-pushed the visitordetails branch 2 times, most recently from dcd2e48 to 1af4204 Compare August 28, 2017 09:40
* update piwik-icons submodule

* fix some system tests

* update screenshots
Copy link
Member

@mattab mattab left a comment

Choose a reason for hiding this comment

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

  • Looks much better, nicely done 👍
  • Noticed the XML export contains invalid XML ie. <Apple iPhone>1</Apple iPhone>, example url
	<devices>
		<Smartphone>
			<count>1</count>
			<icon>plugins/Morpheus/icons/dist/devices/smartphone.png</icon>
			<devices>
				<Apple iPhone>1</Apple iPhone>
			</devices>
		</Smartphone>
	</devices>

@@ -42,7 +42,9 @@
"PagesReportDocumentation": "This report contains information about the page URLs that have been visited. %s The table is organized hierarchically, the URLs are displayed as a folder structure.",
"PageTitlesReportDocumentation": "This report contains information about the titles of the pages that have been visited. %1$s The page title is the HTML %2$s Tag that most browsers show in their window title.",
"PageUrls": "Page URLs",
"PageViewsByVisitor": "Number of times this page was seen in all visits by this visitor",
Copy link
Member

@mattab mattab Aug 9, 2017

Choose a reason for hiding this comment

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

suggest instead: Number of times this page was viewed by this visitor across all visits.

(edit: this was an old comment I forgot to mention, but maybe this string is not used anymore)

@mattab
Copy link
Member

mattab commented Aug 31, 2017

We reviewed with Thomas and here is additional feedback:

  • Is it possible to left-align the text even when icons may be different sizes here?
    pasted_image_at_2017_08_31_01_56_pm

  • also make the font size smaller (the same as the default font size in the visitor profile)

  • Should add some more spacing on the left/right. we reckon adding 5px on each side might be enough, then 3px above and below the "goal number / date" and "Visit SitesManager plugins: added group managment to admin UI #4" maybe 3px smaller. (also possibly add 1 px above and/or below each action as it is hard to separate them and to read because they are quite close to each other.) Like this:
    pasted_image_at_2017_08_31_02_12_pm

  • Speed: over many tests on demo2, it takes 1.5s for server to generate response for 100 visits on 3.x-dev, while it takes server 10s to load 100 visits on the branch. New code is about 5 to 10 times as slow as before. Had you reverted the mysql logic to run one query and fetch all data at once? If you did already, could you run a profiler session quickly to see whether any obvious thing could be improved? especially wondering the time spent in php vs mysql and whether we could run more optimised sql and run less sql queries.

@sgiehl
Copy link
Member Author

sgiehl commented Aug 31, 2017

I've fixed all layout issues. Regarding the speed issue: No, I hadn't reverted the sql changes. But the query is now slower for sure, as it contains four more joins for selecting the content interactions.
And the query for fetching the actions did change much in order get them for all visits instead of only one (idvisit = ? vs idvisit IN (?))

You could try to disable the contents plugin and compare the speed then (that should remove the extra joins). I'm not sure if I will have some time to profile that tomorrow.

@sgiehl sgiehl force-pushed the visitordetails branch 2 times, most recently from 35b917d to c83597e Compare September 1, 2017 10:34
@mattab
Copy link
Member

mattab commented Sep 4, 2017

Merged! 🎉

Still we do need to look at the performance issue because it's important that Visitor log loads fast 100 visits at once. Please share what you find in Profiling? if we need to set it up on demo2 let me know.

fengkaijia referenced this pull request in matomo-org/matomo-icons Sep 11, 2017
@mattab mattab added 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. labels Sep 11, 2017
@sgiehl sgiehl deleted the visitordetails branch October 3, 2017 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment