Using php to include widgets and 'wrap' site

I am having a couple of unexpected issues after installing Piwik. Neither are faults, as such, but they are both things I have managed to do successfully with other scripts and spent the whole of last night trying to solve so if anyone can give any pointers, I would be grateful.

I have tried to include the real time visitor widget in every page of the back end using <?php includes ('/backend/analytics/index.php?etc=etc&foo=bar') ?> . Unfortunately the output gives me a ‘file not found’ error message. If I remove all the variables, it pulls the Piwik file in but gives a different error message (as I on the train to work I can’t give the message at the moment but there was a warming in a div with a red background).

Secondly, the whole point of installing was to integrate everything in the backend rather than all Admins viewing the stats through my google analytics account. I was going to do this by ‘wrapping’ Piwik in the site template. I did this by amending the smarty templates to match the rest of the site. Unfortunately, this just cased a stack of errors to appear as piwik did not like the variables in one of the included files (a config file included in all my pages sets variables such as $isLoggedIn and $isAdmin).

Is there any solution to either if these? These were the two pre-requisites in my head when I started looking for the best analytics solution and as I like what Piwik does, hopefully there is a way around it.

Thanks
Steve

Could anyone give any advice whether this is possible or not? I spent all last night working on this and although I got the Real Time Users widget to show on every page (after editing my php.ini file) there was no formatting applied and the icons (country flag, browser etc) were not showing due to the path not showing correctly.

This would be a show-stopper for me as the whole point was to have certain info readily available on-site rather than logging in to Google analytics.

Thanks
Steve

In your case I would highly recommend to use the IFRAME solution to embed Piwik reports without problem and still have a lot of control over the rendering. Embedding Piwik Reports in Other Websites or Apps - Analytics Platform - Matomo

I did try with the iFrames but as the site is responsive I struggled to get the height and width to adjust correctly and still show all contained data.

I think I will try to decipher the layout of the database tables and write my own queries to pull the data out.

Thanks
Steve

Its fairly easy to adapt width and height of the iframe based on layout (it would be easier than rewriting the output yourself). See code in Widgets improvement: iframes auto height · Issue #3042 · matomo-org/matomo · GitHub