#134 Building AI agents, from consciousness to collaboration (with Daniel Hulme at WPP)
AI expert Daniel Hulme, founder of Satalia, shares his journey from UCL PhD to entrepreneur, discussing AI, consciousness & deep tech.

Note: This how-to is for forcing a hit-level condition within a session-level segment. It is not commonly understood that if two criteria in a user-level segment are in the same condition filter, then they have to occur in the same hit. This can be achieved within a user-level segment, with the default behaviour of adding multiple criteria within a single condition, separated by AND statements.
Doing this with user-level segments, however, will include sessions for those users where they did not meet your criteria. As a result, it’s often necessary to do this within a session-level segment, and it is that requirement that is covered in this guide.
Typically, within session-level segments, the criteria you want to base your segment on can happen independently within the session. So, for example, you might want to look at sessions where the landing page was the homepage and the session resulted in a transaction. These two criteria are independent of each other i.e. they happen at different points in the session. Therefore, you can do this by simply adding additional conditions to the segment and this will give you exactly what you want.
However, there are times when you need to be more specific and tie two criteria together within a single hit. The most common example of this is when you want to include sessions that involved the purchase of a specific product i.e. you want to tie a product name to a purchase hit. This sounds like it should be easy to do and it’s a common requirement, but Google Analytics only offers session-level and user-level segmentation, and what we need here is actually a hit-level condition, as we want to specify a product that was contained within a purchase hit.
The problem with trying to do this within the segment builder for a session-level segment is that it will only look to see if each of the criteria happened at some point within the session, and each criterion is looked at independently. So, if we tried to do this…

…it would show us this:
From GA4 implementation to server-side tagging and consent management — we'll make sure your data is accurate and complete.

Which looks sensible, however, it is very misleading. This will include sessions where a product name exactly matching “Delon Velvet Chair” was included in a hit and in the same session, the unique purchases per hit is greater > 0. However, what it does not specify is that the hit the product name appeared in was the same hit as the purchase occurred. So, it’s entirely possible that this session involved the user viewing the “Delon Velvet Chair” product page (or that product appearing in a product list they viewed), but purchasing an entirely different product.
To ensure that we only include sessions where the Delon Velvet Chair was purchased, we need to force the segment to tie the product name criteria to the unique purchase criteria in the same hit. This is where the hack comes into play.

In the segment above, we are using a sequential condition, and this is the hack. Sequential segments evaluate each ‘step’ as a single hit, so this sequential segment is the equivalent of a hit-level segment.
Below are the results of the two segments we have created: the incorrect condition-based segment and the correct sequential segment.

As mentioned, the incorrect condition-based segment is over-including, as it will include sessions where the product name appeared in a hit that was separate from the purchasing hit. However, the sequential segment forces the condition to be hit-level and therefore this will only include sessions where the product name (in this case, “Delon Velvet Chair”) was in the same hit that the purchase occurred (unique purchases per hit > 0).
From GA4 implementation to server-side tagging and consent management — we'll make sure your data is accurate and complete.
Our instant analytics audit scans your GA4 configuration and flags what's missing, broken or misconfigured.
AI expert Daniel Hulme, founder of Satalia, shares his journey from UCL PhD to entrepreneur, discussing AI, consciousness & deep tech.
Yali Sassoon joins The Measure Pod to discuss Snowplow’s growth, AI innovation, data challenges, and the future of user experience.
Johan van de Werken joins The Measure Pod to discuss GA4Dataform, BigQuery, and the future of analytics engineering and automation.