Submitting ecommerce events to Zaraz via server side push?

Right now all the zaraz.ecommerce() events get pushed over to Zaraz from the browser. However there are times we want to submit stuff from a server side push, not from the client browser. This is useful if we want to submit sensitive information to Google Analytics for instance at purchase conversion time (costs, profit margin etc) and we do that currently with GA using a server side push. But we also want to wire up all of the Order Canceled or Order Refunded events with Zaraz but not all of those happen in the browser. There are back end processes that sometimes do things automatically (discontinued product or something triggering order cancels or refunds) so submitting it via a browser side event is not possible.

Checking how Zaraz sends the data to itself, it just calls /cdn-cgi/zaraz/t on your proxied domain with a JSON blob POSTed to the endpoint. So seems easy enough to clone that and do it ourselves from a server side push, but I am seeing a bunch of extra information that is submitted with the event that I am not sure if it is required? For instance here is an Order Completed event for a test order I did on my dev system:

  "name": "Order Completed",
  "data": {
    "abTestGroup": "",
    "userId": 2,
    "order_id": "8929204",
    "affiliation": "blah",
    "total": 7.7,
    "revenue": 7.7,
    "shipping": 0,
    "tax": 0.52,
    "discount": 0,
    "coupon": "",
    "currency": "USD",
    "products": [
        "product_id": "1274098",
        "sku": "XTA-XS-57022",
        "name": "Xtra Speed Scale LiPo Battery Voltage Checker w/Alarm (2S/3S)",
        "price": "$7.18",
        "quantity": "1",
        "brand": "Xtra Speed",
        "category": "Cars & Trucks"
    "__zarazEcommerce": true
  "zarazData": {
    "executed": [],
    "c": "blah blah blah",
    "t": "Page Title",
    "x": 0.4270534279010272,
    "w": 3840,
    "h": 1600,
    "j": 864,
    "e": 1789,
    "l": "",
    "r": "",
    "k": 24,
    "n": "UTF-8",
    "o": 240,
    "q": [
        "m": "set",
        "a": [
        "m": "set",
        "a": [
    "z_abTestGroup": "",
    "z_userId": 2

So the question is, how much of that zarazData is actually necessary? I think it’s just stuff sent over that Zaraz can pull apart for the event handlers on the other end to do stuff with, so I suspect that entire block could be left out? So all I need to include is ‘name’ and ‘data’? Or maybe send ‘zarazData’ as an empty object?

The userId and abTestGroup are our own variables so those could be dropped (or included directly in the data blob), but not sure about all the rest.

We are about to launch an official HTTP API for Zaraz. It would be much easier to work with it than to try and workaround the /cdn-cgi/zaraz/t. It’ll be available in a few weeks.

Good to know. In the interim before that launches, would calling zaraz/t work at all? My assumption is most of the data in zarazData is not actually necessary at all so my plan to test it was to pass in the request cookies in the c parameter and pretty much leave the rest out? Do you think that will work in the interim?

it would work, yes, but the schema might change in the future.