Machine-parsable timestamps for events in live visitor log API


#1

I’m using the live visitor log API (“Live.getLastVisitsDetails” ) and I can just say that it exactly provides what I needed. Especially having events directly integrated there saves me a ton of work!

There is only one thing that bothers me a bit: Events in the returned JSON/XML only have a field “serverTimePretty” but no locale-independent time field (e.g. Unix epoch, iso9660, …). I don’t see a reason why the API does not contain the date/time in such a format.

Is there a reason for not having a locale-independent date format? I didn’t want to open an issue directly because I’m not sure it is actually an issue (or a conscious omission).

Edit: Also it seems inconsistent to me that included events use “serverTimePretty” which actually contains date AND time while the attribute with the same name for actual visits only contains time (to be used with another attribute “serverDatePretty” ) .


#2

it seems the timestamp is simple enough to add ( https://github.com/FelixSchwarz/piwik/commit/aaec5cad5a3d0878654d2efba68d7975e256797d ) but I’m absolutely no PHP/Piwik expert so I’m leaving it up to you if the commit above is the right fix or not. I can create a pull request if you like.


(Matthieu Aubry) #3

Hi Felix,
feel free to create pull request or issue with your request, cheers!


#4

done: include server time (as timestamp) in visitor actions (visitor live API) by FelixSchwarz · Pull Request #6814 · matomo-org/matomo · GitHub

How about the field naming inconsistency? (“serverTimePretty” contains date AND time while the attribute with the same name for actual visits only contains time) File an issue?


(Matthieu Aubry) #5

Hi there, yes please file an issue for inconsistency!


#6

done: inconsistent field names/content for visitor details in Live API (getLastVisitsDetails) · Issue #6822 · matomo-org/matomo · GitHub

feel free to add any technical references if my issue description is not clear enough.