Database call personalization


#1

Hello,

I need some data from the database and am trying to use Piwik’s existing methods. In particular, I worked now for a while with the getLastVisitsDetails to get what I need. E.g;

$requestLastVisits = ‘method=Live.getLastVisitsDetails
&idSite=3
&period=range
&date=’.$startDate.’,’.$endDate.’
&filter_limit=20
&format=php
&serialize=0’;

Now the thing is, there is a massive amount of data I get when making this call. There are actually many column I could drop as I don’t use them.
For now, I am filtering in PHP but I was wondering whether
a) there is some solution here (maybe with segments?)
b) I should write my own sql calls if I want some precise data
( c) doing this in PHP is ok)

As for the ordering, is there a way to define the column to sort on when using this function?


(Matthieu Aubry) #2

you can use parameters showColumns and hideColumns


#3

Thx Matt for your help,

I come back to this db call, as I still have to juggle to get what I really need.
In particular, I cannot find any way to get the server time of a row in ActionDetails, see you xml example (http://demo.piwik.org/?module=API&method=Live.getLastVisitsDetails&idSite=7&period=day&date=today&format=xml&token_auth=anonymous) from the LiveAPI, in which the action details look like the following:


[...]
<actionDetails>
 <row>
  <type>action</type>
  <url>...</url>
  <pageTitle>Piwik Forums</pageTitle>
  <pageIdAction>169786</pageIdAction>
  <serverTimePretty>Wed 5 Feb 14:36:26</serverTimePretty>
  <pageId>44592201</pageId>
  <generationTime>0.24s</generationTime>
  <icon/>
</row>
<row>NEXT ROWS</row>
</actionDetails>
[...]

So there is the server time, but only as pretty and I cannot find a way to get this time as the clean timestamp.
Right now I parse it, but this is really not a viable solution (serverTimePretty is different in every language, etc)

Thanks in advance for your help !


(Matthieu Aubry) #4

So it looks like the timestamp is missing, maybe we could add it? if so please create a feature request at dev.piwik.org