How to Send Data from the Web Container to the Server Container?

Understanding the process of transferring data from the web container to the server container is important for effective Server Side Tracking (SST). This involves forwarding configuration parameters via the GA4 tag in the web container and retrieving them in the server container. Let's explore this with a practical example. 


You can use this for all data points!


Example: Transmitting Hostname from Web to Server Container

You want to forward the hostname from the web container to the server container. Follow these two steps:


Step 1: Adding Configuration Parameter to Google Tag in Web Container

Navigate to the Google Tag within your web container. Under standard Configuration parameters, such as 'send_page_view', input your desired parameter. For instance, to transmit the hostname, use the parameter 'page_hostname' with the value {{Page Hostname}}. Save the tag and set the container live.


add-configuration-parameter-to-google-configuration-tag


Step 2: Retrieving Parameter in Server Container

Once the hostname parameter is sent to the server container, proceed to retrieve it. In the server container, go to variables and create a new one. Choose 'event data' as the variable type and input 'page_hostname' in the key path, ensuring it matches what was set in the web container. Than save the variable and set the container live.


create-Page-Hostname-variable-in-gtm-server-container


Now, the server container can read this variable. For example, you might use it to trigger an action if the hostname includes '.com'.