Event parameters on GA4 server side

We are sending other events normally, but when trying to create an event that is triggered via code to the stape URL, ga4 does not always receive the parameters that are sent, it only receives them sometimes.

The event is triggered by sending a POST to our stape URL with the json
{
event: “Affiliate Link Clicked”;
affId: string;
}

Testing the same parameters by sending an http request and it works perfectly

In short, the event is sent correctly to ga4, but the parameters are sent sometimes, and we have 3 things inside the event:

affid
affId
event

In the GTM tag we only send:

  • Default parameters to be included: All
  • Parameters to be added/edited: affid = {{AffiliateID}}

GA4 has a lot of payload requirements for this to work correctly. In general GA relies a lot on gtag.js which generates a lot of parameters and events automatically for GA operation.
You can refer to the official GA4 measurement protocol documentation to send events manually:

But unless you have a deep understanding of how GA tracking works, I would recommend tracking all events with tags rather than sending hits from code.