Creating a new rate


I’m trying to create a new rate in my plugin. I have created a class that extends the Processed Metric class and created a public function format that return $formatter->getPrettyPercentFromQuotient($value); Everything seems to be working great until I hover over a date in the Evolution graph. My rate is not formated with a % sign. I have tried to set everything up like the BounceRate, but all I’m getting is just a number without the % sign. When I look at the HTML code, it looks like format is missing the & sign where yaxis is BounceRate and y2axis is my new rate. “yaxis”:{“tickOptions”:{“formatString”:"%s%"}},“y2axis”:{“tickOptions”:{“formatString”:"%s"}}}

What other setting should I set?


Hi Spherexx, are you using git master? There was a bug like this that was fixed ~4 days ago. If you are using master, can you post some example code?


No I’m not, I’m using 2.10.0. Can you show me the fix that was made so I can see if it will help with my problem?

Thank you for your time,


Here is the commit: Fixes #6923, make sure metrics are formatted before generating jqplot… · matomo-org/piwik@8619da2 · GitHub


Thank you, I saw this ticket and it did help with another issue I had with the placement of the decimal. My issues is the % sign is not showing. Please see the screen shot of my new rate. I know the data is getting formated, because in the raw data table, the value is .67. Also, when I print the formated value, it prints as 67%. Yet in the evolution graph, the % just goses away.


Without any code it’s hard to say what the issue is. Can you post some example code that can be used to reproduce the problem?


I found the reason why my new metric was not showing as a rate on the line graph. It is because in core\Metrics.php on line 236, at & gets added only if you have _rate in you metric name. This should be a setting in the ProcessedMetric. Now I have to rename my metric in all the places that I have used it.

(Matthieu Aubry) #8

Hi @Spherexx that’s legit feedback, maybe you could create an issue in our issue tracker to suggest this improvemetn? it would be nice to hear from you as a third party developer, as our goal is to make the platform powerful and easy to use. Such feedback is very useful!