Widgets and date=last/previous X not available

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

/index.php?module=Widgetize&action=iframe&containerId=EcommerceOverview&widget=1&moduleToWidgetize=CoreHome&actionToWidgetize=renderWidgetContainer&idSite=2110&period=day&date=-20days&disableLink=1&widget=1

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.

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.

https://demo.matomo.org/index.php?module=Widgetize&action=iframe&columns[]=nb_visits&widget=1&moduleToWidgetize=VisitsSummary&actionToWidgetize=getEvolutionGraph&idSite=3&period=day&date=2018-01-08&disableLink=1&widget=1&evolution_day_last_n=5