Custom variables api

Hi guys,

I’m storing ‘age’ and ‘gender’ in piwik as custom variables.

But now I want to retrieve this data from the api. I can retrieve one variable at a time however I want to be able to relate the data like this:

Age 21

  • 10 male
  • 5 female

Age 22

  • 7 male
  • 9 female

I have this:
index.php?module=API&method=CustomVariables.getCustomVariablesValuesFromNameId&idSubtable=30&idSite=15&period=day&date=2013-01-15&format=JSON&token_auth=

which returns:
{
“label”: “22”,
“nb_uniq_visitors”: 3,
“nb_visits”: 3,
},
{
“label”: “26”,
“nb_uniq_visitors”: 1,
“nb_visits”: 1,
}

How do I adapt this to return both sets of information?

I would really appreciate some help on this,
Thanks in advance!

YOu might need to use: Segmentation - Compare segments of visitors - Analytics Platform - Matomo

or: http://crowdfunding.piwik.org/custom-segments-editor/