In Google Analytics 4 (GA4), you can send a custom URL using Google Tag Manager (GTM) by utilizing its advanced tracking capabilities to customize predefined and custom parameters in an event.
First, you need to implement GA4 in GTM. Then you can start sending the custom URL by creating a new GA4 configuration tag in GTM and setting your desired GA4 Measurement ID. Once you have the GA4 configuration tag set to fire on all pages, you can start customizing events with parameters.
For example, the page_view event automatically sends the URL. If you want to modify this URL or send a custom one, you can create a new variable for it in GTM, then in the event parameters section of the GA4 configuration tag, you will put the parameter name (like page_location which is the default parameter for URL in GA4) and then, in the value, you would assign the custom variable you created.
In addition to this, you can also make use of ‘Fields to Set’ option where you can mention field name and its value which will get reflected in all hits sent from this tag. You should keep in mind that GA4 focuses more on the concept of ‘Events and Parameters’ instead of the traditional ‘Users and Sessions’ approach that was used in the universal analytics.
However, please note that modifying the page_location parameter will not change the URL recorded in GA4, this needs to be done on your website configuration to reflect the changes on GA4. The method suggested above is to send additional or custom data along with your events to GA4.