Query UserId's


#1

Hi,

I’m fairly new to Piwik. We are using Piwik in our application to track user interactions via http request from our server. In the same manner we are obtaining data with help of the Reporting API. For instance, we suggest reasonable Search terms by quering all entered search terms from our Piwik system.

Now, I’m implementing our own email newsletter campaign stuff. Therefore, I will use Piwik to analyze the success of a campaign. This is straightforward. But I also want to restrict the list of recipients according to their behavior. I append every Link in a newsletter with an userID which shall be tracked in Piwik.

Here my Question, is there a way to query userIDs for particular behavior? E.g. “Get all userIDs that had a Visit within the last x days”, “Get all userIDs that had at least x Visits within the last y days”, “Get all userIDs that had an event of a particular category with given name or value” (I want to mark links with different link categories and fire an event “Link clicked” with the category as value), “Get all userIDs that had interacted with a particular newsletter” (via utm_campaign parameter).
I know that those constraints are just segments and I know how to work with them. So all I need is a way to query for tracked userIDs. I’m quite sure that this is not possible with the pristine Piwik implementation, but could this be achieved with a plugin? Has such a plugin already been developed?

So far, I have no knowledge about PHP in general and Piwik plugins in particular. That’s why I want to know whether I should take the efford to get used to it or this would be useless (for this task).


(Matthieu Aubry) #2

Hi there,

I know that those constraints are just segments and I know how to work with them. So all I need is a way to query for tracked userIDs.

Yes, these can be segments (although not all of the ones you wrote are actually possible).

User ID is also a segment, so you can combine it with your other segments with a AND operator. the segment is userId


#3

Thank for your answer. Unfortunatly, it is not quite what I need. Of course, I could segment for userIds. Then I will get all actions (dimensions or what else I’m querying) that were tracked for a particular user. But I need to get all users that had a particular action.

Nevertheless, I’m proud to say that I have achieved it on my own. Your extended Custom Reports Guide helped me to figure it out. I request ‘Live.getLastVisitsDetails’ for my given segment, site and so on. And then I process every entry to obtain the userId the same way you obtain the browser in your example.