The CustomVariables.getCustomVariables returns Version as the first record in its result set and the CustomVariables.getCustomVariablesValuesFromNameId returns 1.6.19533 as the second record in its result set. This leads me to believe that the first url (Actions.getPageUrls) should work.
I want to segment the results of Actions.getPageUrls by my first custom variable (Version) with a value of 1.6.19533, but again, the getPageUrls url above is not working.
Any suggestions?
What does the customVariableValue number represent? When I change that to 2 it still does not work.
That doesnt return anything either, just a blank page. Does the “scope” of the custom variable matter? We are using the “visit” scope (the one that corresponds to _cvar).
The scope does not matter, all custom variables are merged into this one report. What do you mean it return “blank”? It should at least return empty dataset for example
Yes, it returns <?xml version="1.0" encoding="utf-8" ?> , but no results. I know that theyre in there because of the information that the other two urls (above) returned.
can you put a screenshot of the Visitor Log showing the custom variable (on the left) for the DAY that you also request the API and get no result? maybe there is a typo in your URL? It is supposed to work.
Were you able to get this resolved? I ran into the same problem, and noticed the columns for the custom vars in the log_link_visit_action table. In my case, they were all null. I was not specifying a scope in the setCustomVariable methods, looks like it defaults to ‘visit’. I added two lines to the JS tracking code for each of my params, one for each scope and I am now able to segment the new data by the custom var fields. Seemed a bit redundant, but it works for now.
edit:
Matt, just caught on what you mean by the custom variables being merged.
The issue is that I believe we were both looking to segment by a custom var on a report from the Actions api. Here, it does appear to matter what scope the custom vars are in. I tried the custom variables under both scopes, but that leads to it being double counted in the Custom Variables report as you mentioned above.
I dug through the ENTIRE code base, and the query that is used to determine if there are any qualifying visits only checks VISIT scope custom variables.
So if you try to segment actions on page level custom variables it will never work.
This can be confirmed by reviewing the code in Period.php computeNbUniqVisitors() and examing the sql code generated. It only checks the log_visit table so any custom variables set on actions are not used in counting if there are any visits for this report.
Actions.getPageTitles is the report I am trying to segment. The code ends up back at ArchiveProcessing/Period.php which counts the number of visits that apply before generating the report and checks the Visit scoped custom variable, which of course does not exist.
I was able to get this working for my purposes. To get it to work, I had to make sure that every custom variable is being added twice, once with visit scope and once with page scope. The custom variable counts in the ui are wrong, but the counts when segmenting by custom variables are correct.
Has this issue been resolved? I understand that you’ve said that Actions.get* only works with page scope, but even when I add custom variables with only a “page” scope and then try to filter by those custom variables it still doesn’t work. I am currently getting around this issue by adding both types of scope (visit and page) for every custom variable. This doubles the custom variable counts, but the segmentation by custom variable magically starts to work.
Why will it only work if I have added both a “page” entry and a “visit” entry for the same custom variable? I think it might have something to do with daveb’s post:
[quote=daveb]
Actions.getPageTitles is the report I am trying to segment. The code ends up back at ArchiveProcessing/Period.php which counts the number of visits that apply before generating the report and checks the Visit scoped custom variable, which of course does not exist.[/quote]
I fixed this by modifying the code that counts the number of visits to take into account page variables when counting the actions.
I will create a patch and submit a bug report. This looks like an oversight or just an unexplored code path. Actions.get definitely cannot return any results for page scope variables without my changes.
I fixed this by modifying the code that counts the number of visits to take into account page variables when counting the actions.
I will create a patch and submit a bug report. This looks like an oversight or just an unexplored code path. Actions.get definitely cannot return any results for page scope variables without my changes.[/quote]
Thanks daveb. I will be watching for your patch.
Matt,
Was this just an oversight or is there a reason that Actions.get cannot return results for page scope variables?
Happy New Year! If you are still using Piwik and interested in the awesome new feature of “Creating a Custom Segment in Piwik and apply to reports in Real time!” we need YOUR help, with a little or big donation at: http://crowdfunding.piwik.org/custom-segments-editor/
This will allow to dynamically add or edit, a new set of rules for example “Show all visitors from USA and using Firefox and using Google”. This will be done via a simple to use interface. See screenshots and more info here: http://crowdfunding.piwik.org/custom-segments-editor/
We are crowd funding the future of Piwik and this feature in particular. With your help we can do it.
Im sure there are custom variables under the name ‘player’ with id=1 as I can request them using CustomVariables.getCustomVariablesValuesFromNameId(…)
When I try to use this segmentation it on a request URL that uses the method CustomVariables.getCustomVariablesValuesFromNameId(…) I just get a completely empty result: