Optimising GA4 Tracking with Server-Side Implementation: Solving Unassigned Traffic Issues

by Squash Digital Marketing
November 27, 2024

Optimising GA4 Tracking with Server-Side Implementation: Solving Unassigned Traffic Issues

Introduction

In the world of digital analytics, Google Analytics 4 (GA4) has emerged as a powerful tool for understanding user behaviour and optimising online experiences. While GA4 brings numerous benefits, some users encounter a common challenge: unassigned traffic. Unassigned traffic refers to sessions that have no session_start event recorded, leading to incomplete data and potentially skewed insights.

This article aims to provide a comprehensive analysis of the key factors impacting unassigned traffic in GA4, focusing on the role of server-side tracking and Google Tag Manager (GTM) implementation.

We will explore the trade-offs involved in balancing different factors and discuss the challenges associated with different approaches. Moreover, we’ll highlight the significance of considering the impact when making decisions about server-side tracking. To better understand the issue and solution presented, let’s first examine a real-life problem and its resolution.

Resolve: session_start not firing and causing unassigned traffic

When setting up GA4 via Tag Manager (both client-side and server-side), some users may face the issue of unassigned traffic. Even after diligently following the setup steps, a portion of traffic remains unassigned, leaving marketers perplexed about their audience’s behavior. One possible cause of this issue is missing session_start events.

The “session_start” event is automatically sent by GA4 when you set up your configuration tag. However, when data is transmitted via GTM server-side, there is an opportunity to manipulate the automatically sent data by adding exclusions to the GA4 firing trigger. This can help us customise the data being sent and potentially resolve the unassigned traffic problem.

Solution Attempted: Leveraging Custom Event and First Party Cookie Page Counting

To address the issue of unassigned traffic caused by missing session_start events, we can employ a solution that involves using a custom GA4 event called “session_start_custom.” The key steps involved in this solution are as follows:

1. Excluding session_start from server to GA4

Solution:

In the GTM server-side configuration, navigate to the “Firing Triggers” section for the GA4 tag. Add an exclusion to prevent the automatic firing of the “session_start” event. This will give us greater control over data transmission and allow us to send the “session_start_custom” event instead.

2. First Party Cookie Page Counting

Solution:

In the GTM Web Client, set up a session counting first-party cookie tag that tracks the number of pages a user visits in a session. This tag should always fire before the GA4 configuration tag to ensure accurate page count tracking. Remember to set the cookie expiration to the end of the session.

Guide to First party cookie creation.

3. Custom GA4 Event

Solution:

In the GTM Web Client Set up a custom GA4 event named “session_start_custom” to fire only when the session count equals 1. This indicates the first page visit in a user’s session and will serve as the replacement for the missing “session_start” event.

Read an article by Julien Coquet on First Party Cookie Page Counting.

4. Excluding Custom Event from Main GA4 Tag

Solution:

In the GTM server-side container, exclude the “session_start_custom” event from the main GA4 tag. This ensures that the event is not recorded twice and avoids any data duplication issues.

5. Set Up a New Tag for Custom Event

Solution:

Create a new tag in GTM server-side that fires only on the “session_start_custom” event. This tag now effectively acts as the valid “session_start” event when a visitor opens their session on the first page.

Verification & Results

Verifying in GA4 debug mode now shows the session_start event on first session visits.

The results: We saw a reduction in undefined traffic after the solution was implemented

Challenges and Trade-offs

Implementing server-side tracking and custom event configurations can be technically complex and requires careful planning and testing. Moreover, setting cookie expiration to the end of the session is crucial to ensure accurate page count tracking.

While the solution presented has proven effective in reducing unassigned traffic, it may not be suitable for all scenarios. Organisations must consider their unique requirements, technical capabilities, and resource constraints before adopting this approach.

Importance of Considering Impact

As data-driven decisions become central to businesses, understanding the impact of tracking implementations becomes crucial. In the case of unassigned traffic, a lack of accurate data may lead to erroneous assumptions and suboptimal strategies.

By addressing the issue with server-side tracking and custom events, businesses can gain more reliable insights and make informed decisions to improve user experiences and drive growth.

Conclusion

Unassigned traffic can pose a significant challenge to marketers using GA4. However, with a strategic approach involving server-side tracking and custom event configurations, businesses can overcome this issue and obtain more accurate and actionable data. While the process may require technical expertise and careful consideration of tradeoffs, the benefits of optimised tracking are well worth the effort.

By leveraging GA4’s capabilities, organisations can gain deeper insights into user behavior, better understand their audience, and enhance their online presence. As technology evolves, staying informed about the latest tracking methodologies and best practices will continue to be essential in maximising the potential of GA4 for business growth.

*Note - for a visual representation of the steps and configurations mentioned in this article, refer to the screenshots provided above.*

Contact us to learn more about server-side tracking for your business.

References:

1. *Blog post on First Party Cookie Page Counting* – –https://juliencoquet.com/en/blog/2019/01/24/page-count-triggers-google-tag-manager/#:~:text=We%20can%20call%20it%20%E2%80%9CCookie,the%20browser%20is%20closed%2C%20anyway

2. *Analytics Maina’s YouTube Upload* – https://youtu.be/xeh7SRGCR0o

Let’s work together on your next project

Contact us