UPDATE January 26th: Custom Alerts plugin is now available in the Marketplace! Test it by using the latest Piwik beta version, and then installing the Custom Alerts plugin in one click: go to Piwik, click Settings then click Marketplace and click Install button.
Create custom alerts:
See attached screenshot for preview.
Note: Autocomplete the dimensions will probably not be in the V1 of the script. Autocomplete would be a nice feature as it helps users not making mistakes (eg. is it Germany or DE or germany?).
This plugin requires each Piwik plugin to define their API metadata (list of reports callable, and list of metrics + translations for each metric). Covered in #1485
Note: Custom Alert plugin UI html/js/css controller that allows to select one or several websites will be reused for sure in the PDF plugin.
It would be great if this bit of code was made reusable, thanks!
Thought dump about unit tests
// test alert on one website
// test alert setup on two websites
// test alert setup on two websites, but user doesn't have access to one of these anymore
// test all metrics matches/contains/etc. conditions
// test different periods
// test all increase/decrease/below/above conditions
// tests searched string matches several rows (ie. keywords matching 'test')
// test with bounce rate: bounce rate being a processed metric, all matching rows should be summed before processing the bounce rate
// same test, but simply with Visits evolution
// + test Goal metrics for one website, General goal metric alert..
For each of these tests, or maybe once for all tests, you could generate tracking hits using the code from Main.test.php
For example you would generate 10 or 15 visits to try and match all your use cases, then you would run in one test method all sub tests. (otherwise, generating visits for each test case would make tests run very slow).
In UI, important to test alert name has ', " for sql, and check chinese characters.
(In ) * Small modifications to UI
(In ) Refs #1485
(In ) Refs #1486
Patch by halfdan required by Alerts plugin
I'm uploading a current status here - not quite working, more for code review and feedback. I'm half-way through migrating to the new UI that was introduced with PDFReports.
Integration.test is testing addAlert/editAlert (success!) and processing of alerts (little buggy).
I'll be travelling for some days and will finish Alerts when I'm back.
delaying for now, even though I hope it makes the cut :)
Halfdan, do you think the plugin can be put into trunk at some point? This would be a great feature and it is more than half done for sure :)
An interesting article about Custom Alerts: http://www.kaushik.net/avinash/2010/06/leverage-web-analytics-custom-alerts.html
@halfdan Have you had a chance to make progress on the feature? Even if not complete we'd be very interested to see what you've done and if we can reuse it. Thanks!
Hi, I would be very interested to help or to continue this project. @halfdan, it would be very nice if you could report what is working and what not, and which kind of problems you encountered.
that is very kind of you. I am however still working on this plugin and hope to have it finished by the end of the year. I have not responded to matt's request since I am in direct contact with him.
I will let you know if I need any help.
If you are interested in this feature, please pledge now! We are running a campaign for Custom Alerts: http://crowdfunding.piwik.org/custom-alerts-plugin/
It will be awesome, but we need your support!
I'd love to see another feature.
Piwik could become a helpful tool in order to be alerted when it comes to problems with the website.
There are a lot of things that can go wrong after updating your website. You have a lot of log files and tests but nevertheless sometimes there goes something wrong on the website (e.g. browser problems with js, layout problems, ...).
Sure, you could have an alert for higher bounce rates on critical pages (e.g. product pages).
It would be great if there were alerts that are a bit more complex.
Alert if the ratio of visitors that view a product page, add a product to cart and checkout decreases.
This means the checkout funnel should alert me if there is a problem in one of the steps.
@mohelten Piwik does not yet support conversion funnel, so this is not possible, but it's a good idea for the future.
I got a few emails in the last few weeks from funders asking about Custom Alerts.
We have some news: while unfortunately Fabian @halfdan is right now in hospital recovering from accident but will be out soon. AND he has a version of the plugin for beta which we'll release as part of Piwik 2.0 as a core plugin, as announced. Stay tuned & halfdan hope you get well!
@Fabian any update for our community of funders eagerly waiting to hear an update? hope you are well!
No update yet, so likely won't make it to 2.0 (sorry for such long wait to all funders!)
In f9ff7412c7fe8deec56f41a1b54f3409a72d1d09: refs #1486 made previous alerts plugin compatible with Piwik 2.0 and added the possibility to actually list, create and edit alerts
In 1e6cece49d0838e6518bb8ce2c9077a9c0555dfe: refs #1486 code cleanup, implemented some comparisons, bugfixes
In 3bd9c0b2d09a0654540a1f86601416bb6074bdbe: refs #1486 we do not want to have sql statements in controller, api and plugin class. Put them in a model, makes it also better testable
In 450e861b69b3dafff24f10f446dd41932270bf31: refs #1486 some more cleanup, bugfixes and moved defined metrics/group conditions to the processor as only this class can know which ones it supports
In 853b18cd1a5722650f18189e26afbea13bb20d92: refs #1486 more refactoring, bugfixing, display report name is list of all alerts
In 8d02c09125bdfb308bee630687c0adf730b9c241: Deleting custom alerts plugin for 2.0.2 release refs #1486
PHP Strict standards: Declaration of Piwik\Plugins\CustomAlerts\tests\CustomProcessor::getMetricFromTable() should be compatible with Piwik\Plugins\CustomAlerts\Processor::getMetricFromTable($dataTable, $metric, $filterCond = '', $filterValue = '') in /home/travis/build/piwik/piwik/plugins/CustomAlerts/tests/ProcessorTest.php on line 15
I stopped using refs once we created the CustomAlerts repository. We have a nice history just for this plugin there and the refs are not being displayed here anyway. I think only for Piwik repository. We changed this recently with the Git problems and I think we even did not process all repositories before.
The git problems should now be fixed, now that git was upgraded on the server.
What would it take to process all repositories again and have trac Refs work on any github.com/piwik/* repository?
Trac config ini needs to be adjusted for this. To work for all repositories automatically won't work
In c2d80690b16dc937747e0d3ba1c92f5718b57ef4: refs #1486 make it possible to reuse only phoneNumbers and emails without the html for graph type
In 87696120917c4b21bbaa9352c6299974f362851f: refs #1486 fix link to MobileMessage settings works only if current action is index
In 8b76960d3575d8fa98bd5c608a68893afab75e79: refs #1486 move script tag into td to make sure nth-child(2n) css selector works. Otherwise sometimes two rows have same backgroundcolor in an entitytable
In e13682cfbaaa14ecd1d5807eb6687f0b55278498: refs #1486 fix selected phone numbers are not recoginzed
In c18171d4c4c15a3106c4ed5865541a8f8bfc014a: refs #1486 trigger an event when a phone number is deleted
In 5773706aa201b003ad10790de4d67b2709e802fa: refs #1486 added some methods needed in CustomAlerts plugin to validate report and metric is still valid
In 329369d5117c082377d75dd6d10ed3e61241c495: refs #1486 fix website id is not updated but website name if someone switches the website in website selector
In 32f40ab9525256f1f7654d54f3307a4e9e1bc7c4: refs #1486 added method to detect whether current year is a leap year
In a9d8fc6d48e6c823c501dd834170d6d175b4b818: refs #1486 added method to create a scheduled time depending on the websites timezone
In 66bc3b1d60e2e995781dcfb9fe25b0ef81f9132e: refs #1486 if AllWebsites was selected in the site selector, the value was of the site selector was never updated. Also do not toggle the name of the current selected website with the clicked website as it is kinda confusing and leads to website names appearing multiple times
In 3664f48d1d0f523f572c038acb15868701e6f16c: refs #1486 added an anchor so we can directly link to a specific plugin
In 15853da8b03f0ab7a858a2335e9dbd62b7db4116: refs #1486 execute applyQueuedFilters only if not disabled, prevents an issue when filter_truncate and flat=1 is used in Actions.getPageUrls: Trying to add two strings values in DataTable\Row::sumRowArray
In 04ac332bde0a9f3629722aa4cf31e12f031afda7: refs #1486 updated submodule where we now store the reportUniqueId instead of module.action to support all reports (goals etc)
In 4b10f3953498ce8c77a073816f9e4f5c0a82721c: refs #1486 load fixtures from plugins when running UI tests
In 961f0e95553a3cf4afcc5e9ecec86579a87be980: refs #1486 do not apply queued filters when they are disabled
In 9dbe600d619736e6e8136c9f047eb100fde6e1d5: refs #1486 in case we do not apply the filters directly, keep them in the new data table. Otherwise we cannot apply them later in the customAlerts plugin manually
In 711456dea7e892b7f0adfb8e87a03d49b2ada310: refs #1486 this should fix the scheduled alerts for month or week run one day too late under circumstances.
In 416a911a45e17b44d3f1496ae0bfe78aee937327: refs #1486 fix tests
Closing this ticket for now. Please create new tickets for changes