Direct query to the db (sum of conversions)


#1

Hi all!

First: I have Piwik on my site and I’m very happy with it! :slight_smile:

I have set up a “goal”. Now: i would like to query the piwik database via PHP to get the total number of conversions (just the total, i dont mind the date rage, etc.). I need to use that numer on another application (witch sum the total conversions from different sources).

Could you please help me out? Thanks!
J


(vipsoft) #2

matt: I think jack wants “subdomain” to be a segment.

(editorial note: this comment was intended for another topic)


#3

It’s easier! I do not have subdomains. The other sources are external websites witch i do not host.

The only thing i need to do is to get from the db the total number of times the goal “XYZ” has been reached (unique users). The goal is the “id=2” in “piwik_goal” table. :slight_smile:

I guess i have to query the “piwik_log_conversion” table in some way…

J


(vipsoft) #4

click on the API link on your dashboard;
scroll down the list of API methods to Goals.getConversions()


(vipsoft) #5

(sorry, I know you asked for direct db access.)


#6

well… i need that number in a php variable, how i get it it doesent matter so much. can i use the api in some way?

thanks :wink:
J


#7

any clue? :slight_smile:

J


(Matthieu Aubry) #8

Jack, yes you can use it see example in piwik/misc/exampleAPI *.php


#9

Thanks matt! I tried to look at “api_rest_call.php” and “api_internal_call.php” but i really do not understand where to start ;). Is there an online references or some pratical example somewhere?

Thanks in advance,
J


(Matthieu Aubry) #10

See the file api_community_sticker.php