Piwik custom dimension and segments

We use Piwik cloud (innocraft.com) for analytics and have a custom dimension called channel_perm_id with scope Visit, it’s called dimension1 and is transmitted via JS Tracking API. Using the piwik admin panel we can verify that the dimension is set correctly and transmitted by each visitor.

Now we want to query based on this dimension1 aka channel_perm_id:

curl -i https://###.innocraft.cloud/index.php?segment=dimension1==2ceb64954d4e46f49bc6afa310cf92f&token_auth=###&format=xml&date=today&period=day&idSite=8&module=API&method=VisitsSummary.get

The important part is

segment=dimension1==2ceb64954d4e46f49bc6afa310cf92f

which causes this query to return an empty response:

<result>
<nb_uniq_visitors>0</nb_uniq_visitors>
<nb_users>0</nb_users>
<nb_visits>0</nb_visits>
<nb_actions>0</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>0</bounce_count>
<sum_visit_length>0</sum_visit_length>
<max_actions>0</max_actions>
<bounce_rate>0%</bounce_rate>
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>0</avg_time_on_site>
</result>

Without the segment parameter the response looks like:

<result>
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_users>0</nb_users>
<nb_visits>6</nb_visits>
<nb_actions>0</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
<bounce_count>6</bounce_count>
<sum_visit_length>2469</sum_visit_length>
<max_actions>0</max_actions>
<bounce_rate>100%</bounce_rate>
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>412</avg_time_on_site>
</result>

It looks like the custom dimension is somehow not aggregated in piwik.

But if we use the Live module (Live.getCounters instead of VisitsSummary.get), the query works fine.

So we think it has something to do with the scope maybe.

Any ideas are highly appreciated!

Is the segment correctly displayed in the reports when you use the GUI Segment-Editor?

Hi, when i create a segment with channel_perm_id and use an „is“ condition everything is showed correctly, but it is an fixed segment. I need on the fly segmentation, which should work just fine according to the docs. I could use custom variables but im not sure if this is the correct way…

The segment in the GUI is exactly the same as the request to the API. Have a look at the segmented requests, if you can spot a difference in the segment parameter of the URL (your API request vs the GUI segment editor generated request).

Good advice. Well, the GUI defined segment indeed shows the same problem, so only live data (Vistor log…) can be selected using this segment, all other data show “There is no data for this report.”

This means, the data is obviously not aggregated … Hm. As I said, we are using Piwik Cloud, can it be configured somehow ??

Thanks!

@chrisprobst I forwarded your question to the Piwik Cloud staff, you should get an answer soon.

1 Like

Hi Chris, We’ve sent you a message to follow up on this, thanks @peterbo for letting us know