Short answer:
Try to not use the measurement protocol unless you're sure there's no other way. MP is messy, and GA4 certainly didn't make it better.
Long answer: Inspect a standard GA call to the collect endpoint even on this page. See how many dimensions are set in it even if just by default:
Now most of them are vital for reporting. They keep track of a bigger picture. GA wasn't meant to be used as a debugging tool where you can just send a few dimensions arbitrarily and expect them to be available.
The issue with using the measurement protocol and normal tracking interchangably is that you have to make sure at least the session id and the client ids are synced inbetween (cid and sid in the screenshot). You have to also carefully keep track of the referrer, document location and document path (dl, dp, dr) parameters on your backend. But probably even more.
While it's doable to mix the two protocols, it's rarely viable. Just too much back-end work involved.
There are better solutions to your problem.
- A classical solution would be UTM parameters. They allow you to
hardcode dimensions in the urls to be published on third party sites
via query parameters. Once the user gets to your site with those
parameters in the URL, the front-end GA lib will consume them and
you will be able to report based on those parameters.
- If you can't mutate your links on the third party site, you could use your backend to rewrite it on the fly and inject the utm params through the backend for the FE to consume.
- Finally, UTM params tend to set the source and medium besides the campaign, platform, and other optional dimensions. That might be more than what you need. In that case, I would suggest using your backend to set a cookie (or the state, or the query params, however you communicate with the FE) for the front-end to consume. On the front-end, before sending the GA pageview, you consume the cookie and then set any fields you want in that pageview. This is a good solution too.
If you're setting custom fields (also known as event parameters), you need to make sure you're registering them in GA4 interface as custom dimensions. Don't forget that your data won't be available in reports immediately. Real time reports show it, but normal reports won't show it immediately. GA4 says for up to 48 hours for the events to show up, but it usually takes just a few hours.