Articles on: Client Side

Creation of the Google Tag (GA4 Configuration Tag)

The GA4 Configuration Tag is used to track user interactions on your website and send the data to Google Analytics 4 for analysis. With Trytagging, the data flow is securely managed through bth client-side and server-side tagging, ensuring the safe handling of sensitive information. This setup supports integration with external platforms like Meta and TikTok Ads, allowing for seamless data exchange. The tag is configured to fire at the right time using specific triggers, ensuring accurate and efficient data collection for analytics and marketing purpose

Prerequisites



PrerequisiteElaborationReference
Create a Google Analytics 4 Account and PropertyA GA4 account and property act as the foundation for collecting and analyzing your website’s data. Without this setup, your event data will have no destination.Learn how to create a GA4 account and property
Create a Web Data Stream for Your WebsiteData stream links your website to your GA4 property, allowing user interactions like page views and events to be sent for analysisLearn how to create a web data stream
Set Up regular Google Tag Manager (GTM) ContainerGTM allows you to manage and deploy tracking codes without altering your website’s code directly, making it easy to create and update tags.Learn how to set up GTM
Create a server container on trytaggingA server-side GTM container securely processes data on the server, enhancing privacy and reducing client-side load.Create a server container on trytagging
Create a CNAME record in the DNS settingsA CNAME record (Canonical Name) in the DNS settings is used to map a domain name to another domain, which is especially useful when setting up a server-side containerCreate a CNAME record in the DNS settings
Create a server container on Google Tag ManagerA server container in Google Tag Manager processes and manages data on a server instead of directly on the user's browser.Create a server container on Google Tag Manager


Set Up GA4 Tag in Web Container



The first step in the setup process involves the client-side GTM container. This container is responsible for capturing key user interactions like page views and clicks. To configure GA4, create a GA4 Configuration Tag using your GA4 Measurement ID. This setup ensures that data is captured before being sent to the server-side container for additional processing.

While setting up the Google tag, you will need your Measurement ID to link your Google tag to your GA4 property. Refer to the documentation Find the Measurement ID for guidance.

In this section, we’ll focus on setting up Google tags, starting with configuring the Google tag in Google Tag Manager.


Add Required Parameters



When setting up the GA4 Configuration Tag, you should always add certain parameters to ensure everything works correctly. These parameters help control how page views are tracked, how data is collected, and how it is sent to the server container.

Make sure to include the "send_page_view", "first_party_collection", and "server_container_url" parameters to optimize your setup and ensure smooth data processing.



If you want to add parameters for specific use cases such as sending user data, integrating with external platforms, or tracking ad campaigns, you can configure the following parameters accordingly:

Add parameters to send visitors email with events

Adding Parameters for Webhooks

Add Parameters for Meta Ads with Server-Side Tagging

Add Parameters for TikTok Ads with Server-Side Tagging

Add parameters to send visitors email with events



If you want to send visitors' email addresses along with events, you can add specific parameters to capture and send this data. The parameter user_data can be configured to include the email address, ensuring that this information is sent with every event. This allows for better segmentation and tracking of user interactions, especially useful for personalized marketing efforts or detailed analysis in platforms like Google Analytics 4.

Sr NoParameterValueExplanation
1user_dataUser-Provided Data variable with Manual Configuration (user-email variable)This variable holds the user-provided data, specifically the user's email, stored in the selected email variable.


Add parameters to send visitors email with events

Adding Parameters for Webhooks



For integrating with external systems or platforms, you can add parameters for webhooks. These parameters allow you to send event data to external services for further processing. For example, clientId, sessionId, and session_count are common parameters that capture user-specific information, session details, and the number of sessions.

These values can be stored in DataLayer variables and sent through the GTM container to integrate seamlessly with your webhook endpoints, enabling real-time data synchronization.

Sr No.ParameterValueExplanation
1clientIdDataLayer variable with marketing.user_idThis variable tracks the unique user ID from the marketing data layer.
2sessionIdDataLayer variable with marketing.session_idThis variable tracks the session ID from the marketing data layer.
3session_countDataLayer variable with marketing.session_countThis variable tracks the session count from the marketing data layer.


Adding Parameters for Webhooks

Add Parameters for Meta Ads with Server-Side Tagging



If you're working with Meta Ads and using server-side tagging, it's essential to include specific parameters for accurate tracking. For instance, x-fb-ck-fbc and x-fb-ck-fbp are parameters that capture Meta's first-party cookie values. By adding these parameters, you ensure that Meta Ads can properly track conversions and interactions from your website, optimizing your ad campaigns and improving data accuracy.

Sr No.ParameterValueExplanation
1x-fb-ck-fbcFirst Party Cookie variable with value '_fbc'This variable tracks Meta's first-party cookie (_fbc), used for conversion and interaction tracking.
2x-fb-ck-fbpFirst Party Cookie variable with value '_fbp'This variable tracks Meta's first-party cookie (_fbp), used for tracking user behavior on Facebook.


Add Parameters for Meta Ads with Server-Side Tagging

Add Parameters for TikTok Ads with Server-Side Tagging



If you're using TikTok Ads for server-side tagging, you need to add parameters like ttclid and ttp, which are related to TikTok's cookie tracking. These parameters help TikTok identify and track user interactions, enabling you to measure the effectiveness of your TikTok campaigns. Additionally, setting up a Cookie Creator Tag for the ttclid cookie ensures proper tracking for TikTok's ad platform, providing you with accurate conversion data.

Sr No.ParameterValueExplanation
1x-tiktok-ck-ttclidCookie-x-tiktok-ck-ttclidThis parameter is used to track TikTok click IDs from cookies
2x-tiktok-ck-ttpCookie-x-tiktok-ck-ttpThis parameter is used to track TikTok tracking parameters from cookies


Add Parameters for TikTok Ads with Server-Side Tagging

Advanced Settings



In the Advanced Settings, you can adjust the Tag Firing Priority to ensure that the Google Tag fires first when multiple tags are triggered by the same event. Setting it to 1000 guarantees it takes priority.



Trigger Condition



Next, define the trigger conditions to ensure the GA4 configuration tag fires when the correct user and product information is available. This helps improve the accuracy and relevance of your data tracking by firing the tag at the right moments.



Preview Tag



Finally, use the preview function in GTM to test the setup before going live. This allows you to check if the tags are firing correctly and if all data is being captured as expected. Once everything is verified, you can publish the container for full integration with GA4 and other connected platforms.

Updated on: 08/01/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!