The presence of the getDashboards() method suggests the presence of a setDashboard() method.
And yes, I agree the Matomo manual has more the feel of an advertising gimmick for the purchase of paid consultation than a rigorous open source manual for further development by freelancers who would like to promote Matomo through their own work and initiative.
What do you think is wrong with the developer documentation? If you have any specific ideas how to improve them, I can try to allocate some of my free time this summer to try to improve it.
You an also report issues directly on the website repostitory:
As explained here the API you are looking for is Dashboard.createNewDashboardForUser.
@Louis_Pitchforth
If you want to display just the dashboard without an UI (similar to zen mode) you can try this API as explained on the widget page.
Thanks for taking time to reply, but what you have suggested is what I am already using. If you widgetize the full dashboard via the API then the segment editor is also shown as part of that widget and I don’t want to show this element.
I like the documentation, use the Matomo help pages every week.
Hi, Lukas! It is hard to know where to begin. This entry is, however, a good case in point. The manual provides a sample outcome for a method name that shows clearly what modules the current Dashboard contains and then provides a method name for customizing it. Unfortunately, the only example provided for customization is how to restore the default setting. Or, am I completely in error, and that the parameter value
means the number of new “default” widgets that I would like to add? But, things become worse, for once set how would I go about deleting a widget (Louis’ question ultimately)? Then, under the assumption that the word “default” refers to widgets that are a part of the CORE, I am left with the question, “May I add widgets that are not part of the core?”
Now, please Lukas, do not attempt to clear up my doubts with regard to this question for my sake, for I am currently adrift with other Matomo matters that are more pressing, but no less confusing. Louis’ entry caught my eye for future development, and I sought to lend a hand in good faith. I like to return what I take, and others such as yourself have helped me. I am not trying to be overcritical, only real for the sake of everyone who like me is a struggling start-up.
I know how to show/hide widgets, just the segment editor I want to control and really without having to customise the style templates as I don’t have access to that area of our server.
A great addition to Matomo would be finer governance of the user policy as I find that anonymous, or read is just too binary for what I need. Admin and super user are too high above read access to assist with most of my requirements and so I end up building a lot of custom tools, either web based or in excel with power query.
Louis, unless I am mistaken, your authorization token gives you complete access to the Matomo reporting API. You have only to send your authorization token with an HTTP Request. In lieu of the fact that there does not appear to be an ON/OFF button for segment editing, you would simply drop the &segment parameter when making a request.
In effect, you would have to build your own Dashboard. This you could clearly do without having to apply the mysterious
Dashboard.createNewDashboardForUser( )
method that may or may not allow you to specify the &segment parameter.
Also, if you should discover through experimentation how to make this method work, you might want to try adding the segment content operator followed by null or nothing in an effort to suppress the editor – namely,
&segment=@
Roddy
P.S. Do not forget to register your suggestion with Matomo, by the way. It is obviously a good idea.
I probably didn’t explain myself properly here. I am not creating a dashboard in this specific API call, that has already successful completed in a previous task. This use case is to widgetise the full dashboard for a specific user, once their dashboard is built and just hide the segment editor only.
Wether a segment is passed or not doesn’t effect the returned dashboard view only the returned analytics within the widgets for that dashboard ID or default if no dashboard ID is declared. The segment editor would just load with “All Visits” and not a custom or previously added segment for that user.
Widgetising the full dashboard will by default always show the segment editor, along with the widgets (default or customised) for the user that the token_auth belongs to. What this means is that the user can add segments themselves and I don’t want that to happen for this use case.
I don’t have a web host for this and that is why I am using a JavaScript bookmarklet to call the dashboard in an iframe and use jquery to overlay that iframe over the webpage/area they want to segment by (applied by code not by the user).
I don’t expect Matomo to do the above, just only if there was a url parameter I was missing that could hide the actual segment editor.
This feels like a feature request, I appreciate you taking the time and effort to collaborate on this @Kiusau.
OK. So open the resulting document in Page Source, discover the HTML element that contains the segment option, and hide or simply eliminate it with a script.
I definitely agree that the option that you seek should be included, and I would very much like someday to be able to display widgets without having to expose one’s authorization code. Unfortunately, the Matomo to-do list is quite long, and I do not expect anything to happen in short order, if ever.
I do believe that much can be achieved with something called w_get, but for the moment I do not have access to my own terminal commands that would allow be to install and activate it…
I don’t think that’ll work due to Matomo being hosted on a different domain to the site being tracked (same origin policy) but I will definitely test this.
In this case I am not downloading a data file type, like json or csv.
Widgetising the full dashboard doesn’t work in that way.
To my knowledge web browsers don’t allow (by design) iframe content to be changed on a different domain to its source.
Also, I only wanted to know if there was a parameter that could be utilised, not inflate my bookmarklet by adding in lots of extra code as I can’t reference any assets due to having no web host and so all of the functionality is produced on the fly.
Thanks for all your suggestions, I think we have reached a conclusion. That there isn’t a parameter to control the segment editor visual element in this widget.
To my knowledge web browsers don’t allow (by design) iframe content to be changed on a different domain to its source.
If you have access to it, use w_get. With this you should be able to call the contents of the dashboard without the iframe into a separate document, alter it there, and then feed the modified dashboard into your own iframe via the src attribute.
Now, I have not yet tried this myself, but it is surely my intention in the near future as a means to hide my authorization token. Simply, for the moment I do not have access to w_get
I know this is more than 4 years old - but I am having exactly the same problem as Louis. I would appreciate this API feature as well - hiding the segment editor via an URL parameter. On GitHub the issue is still open, so probably not so easy to develop…