Troubleshooting eCommerce: Error 400

Hi folks,

when manually adding eCommerce items and transactions, the resulting Matomo tracking URL ends up malformed (error 400) for some reason.

For what it’s worth, I’m working on a GTM installation firing the Matomo code as a custom HTML tag, in which the eCommerce attributes are generated.

An example of a 400 URL is:
https://juliencoquet.com/matomo/matomo.php?idgoal=0&ec_id=C123456&revenue=386.51&ec_st=386.51&ec_tx=25.51&ec_sh=10&ec_dt=false&ec_items=[["1286"%2C"My%20First%20Widget"%2C"Widgets"%2C312%2C1]%2C["9999"%2C"Gizmo"%2C"Gizmos%20etc."%2C39%2C1]]&idsite=1&rec=1&r=466769&h=16&m=45&s=48&url=http%3A%2F%2Fjuliencoquet.com%2Fmicrosite%2Fgtm%2Fpurchase.html&_id=99ee95fc998b7977&_idts=1555411196&_idvc=2&_idn=0&_refts=0&_viewts=1555418544&_ects=1555425842&cs=windows-1252&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=3200x1800&gt_ms=134

Any help is appreciated.

Update: the funny thing is that my code first calls matomo.php?idgoal=0 (with status code 400) THEN calls the actual page view with matomo.php?action_name=…