Widgets and date=last/previous X not available

(Louis) #1

Why can’t we use date=lastX or date=previousX in a Matomo Widget, but can in standard API reporting, where the format is a data file and not a widget?

@matthieu , is this something planned in the future?

I’m confused as to why some parameters work in some modules and not others. Not technically, But strategically as a complete product.

Source: Embedding Piwik Reports in Other Websites or Apps - Analytics Platform - Matomo

And I have tested this also in demo.matomo.org and in my own personal environments.

Hopefully I have missed something and the situation isn’t how I have found it to be.


I noticed that it does take any input as supported by strtotime, so you could do something like this for a single day


But that does not work when period = range AFAIK.

If you’re creating these as IFRAMEd widgets you could use javascript to build the IFRAME URL dynamically and calculate the equivalent of lastX at runtime.

(Louis) #3

For this particular use case I can’t deploy any other code, only utilise an iframe tag. I have other use cases that thankfully I don’t have to rely on such limitations and use Ajax and D3 to get and transform the data from Matomo.

I did resolve this issue though as lastX and previousX didn’t work in the VisitsSummary module, evolution_day_last_n=X did.