Could not use segment in api call to get visiting result


I am the customer of and I am trying to integrate piwik cloud service with our produciton. The tracking part works very well. But I get problem to use the API to get the visiting result.

E.g. If I run the , the reuslt is

    "value": 11

That is correct. But if I try to add segment into the query, I always get zero in reuslt, e.g. , the result is

    "value": 0

I tried to change the segment value to “browserCode!=CH”, “browserCode!%3DCH” or “browserCode%3D%3DCH”, but the result is always 0 in value.

I tried to look at api documents and FAQ for the whole day, but I could not get this fixed. Could anyone give me some hints in this. Thank you very much.

I also found that I can make this work in piwik demo sysem:!=CH , and the result is

    "value": 91

I could not figure out why similar query could not work in my account in

It will be appreciated if anyone could give me suggestion in this.

Jerry Liu

I got reply from support of innocraft that I must manually created the segment in the UI editor and waiting a few hours until it is available in the api.

Yes, it works now with segement. I need to take a look at the api to see if I can use api to create segment instead of creating in the UI.

Thanks for the support.



This is the API for creating segments:

Just noticed there is an typo and opened a pull request to fix it:

Hi Lukas,

Thank you very much.

Best regards,