Tracking action scope custom dimensions in the HTTP API

We have a process that loads visit data into Piwik using the HTTP Bulk API.

This process loads eCommerce orders into piwik, and works well, except when trying to provide custom dimension variables.

Through debugging, I can see that it’s accepting visit-scope-level dimensions but not action-level:

Dimension3 is an “action” scoped dimension where we provide a retailer name. I can see that the value is provided, but Piwik always shows it as ‘0’.

DEBUG: array ( DEBUG: 'idvisit' => '110', DEBUG: 'idvisitor' => 'a7d97f34ba82f3af', DEBUG: 'server_time' => '2017-10-04 12:47:00', DEBUG: 'items' => 1, DEBUG: 'custom_dimension_1' => NULL, DEBUG: 'custom_dimension_2' => NULL, DEBUG: 'custom_dimension_3' => '0', DEBUG: 'custom_dimension_4' => NULL, DEBUG: 'custom_dimension_5' => NULL, DEBUG: )

If I add another visit-level custom dimension the above would show custom_dimension_6. This tells me that it’s opening “slots” for visit level dimensions.

I believe it’s expecting a visit-level dimension because when I provide a visit level dimension, it shows as

DEBUG: array (
DEBUG:   'idvisit' => '110',
DEBUG:   'idvisitor' => 'a7d97f34ba82f3af',
DEBUG:   'server_time' => '2017-10-04 12:47:00',
DEBUG:   'idsite' => 1,
DEBUG:   'visitor_days_since_first' => '0',
DEBUG:   'visitor_days_since_order' => '0',
DEBUG:   'visitor_returning' => '0',
DEBUG:   'visitor_count_visits' => '1',
DEBUG:   'referer_keyword' => NULL,
DEBUG:   'referer_name' => NULL,
DEBUG:   'referer_type' => '1',
DEBUG:   'location_city' => NULL,
DEBUG:   'location_country' => 'xx',
DEBUG:   'location_latitude' => NULL,
DEBUG:   'location_longitude' => NULL,
DEBUG:   'location_region' => NULL,
DEBUG:   'idorder' => '9780',
DEBUG:   'idgoal' => 0,
DEBUG:   'buster' => '2457535116',
DEBUG:   'revenue' => '1949.97',
DEBUG:   'revenue_discount' => '0',
DEBUG:   'revenue_shipping' => '0',
DEBUG:   'revenue_tax' => '0',
DEBUG:   'items' => 1,
DEBUG:   'custom_dimension_1' => NULL,
DEBUG:   'custom_dimension_2' => NULL,
DEBUG:   'custom_dimension_3' => '2.12',
DEBUG:   'custom_dimension_4' => NULL,
DEBUG:   'custom_dimension_5' => NULL,
DEBUG: )

It feels to me like we’re tracking a visit, and the system can’t accept both visit and action-level data in the same API call (though we can set Action Name)

Should we initiate a second API request for the action-level data and attach the same visit id? How can we save the action-level custom dimension data?

Thanks!