'GTM and GA4 configuration - Losing custom dimensions

We recently setup our GA4 account in order to be ready for the upcoming end of Universal Analytics.

However, we are getting a lot of (not set) on our reports when it comes to some custom dimensions that we have setup. We suspect that there could be some duplication on the requests being sent to our GA4, because every time I hit a link and we go to another url, there is 2 requests like this one:

And the second one doesn't contain the information of our custom dimensions. The first one does.

My questions are:

  1. Is it correct to have 2 requests being sent to GA4 every time I hit a link?
  2. Are these scripts correct?:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source