Dynamically Update Widget


(KyleM) #1

The problem: I need to dynamically update a widget. An event occurs in the Visit.php script using Piwik’s way of firing events. Now I want my widget (defined in one of my plugins) to listen for that event and update when it occurs. Is this possible? The getListHooksRegistered allows me to listen for events, but not for the purpose of updating widgets, as far as I can tell. My friend tells me the only possible way to update a widget (or webpage) in response to an event that occurs elsewhere (i.e. not a user initiated event) is to log the event in a database, then have an AJAX function on loop that checks the database for updates. Is that true, or is there a simpler, more effective model?

As always, thanks very much for your time.

-Kyle


(Matthieu Aubry) #2

You need to pass your data from the Tracker to your widget. There is no other way than store it somewhere, and have your widget pull that data from this datastore (like the Live! plugin does)