Ever since I first learned it was possible, one of my favourite type of segments to build is the visit-in-hit segment. I've always been a fan of logic and puzzles, so learning how to build segments and understanding what type of data they return was particularly interesting. I still remember the first time I learned about segments and was told that you put smaller containers inside bigger ones, and to do it the other way would make it invalid. I took that as fact for a very long time.
Then one day I had a fallout visualization that I wanted to build a segment from. So I right clicked and selected build segment. Looking at what workspace generated I saw a visit container inside of a hit one. This went against what I had been taught, and it sent me down a rabbit hole of investigation. What I eventually learned was that segments with a bigger container inside a smaller one (like visit-in-hit or visitor-in-visit) does work and provides some very specific insights. I got a chance to talk about this back at the Analytics Rockstars session at Adobe Summit this year, but 4 minutes isn’t really enough to deep dive into a topic like this.
Logic of the Visit-in-Hit Segment
At a very basic level, a visit-in-hit segment returns information in a specific hit that is associated with your visit level conditions. Say for example you want to see information related to views of a specific product, such as video game consoles. BUT, you only want to see the information for video game consoles if the customer also saw video game software and accessories in the same visit. Starting with your inner container, the visit container, you put all of the conditions that you want to be true. You want a visit that has seen these three product categories. But you only want to return information for hits that have video game consoles. So you want to put this condition in both the visit container, and outside of it in the overall hit level segment.
When you return your data, you may or may not see data for the other categories. In the case of products, it’s possible to see more than one product in the same hit, such as in a cart or checkout page. So you may still get hits for software and accessories (or other categories), but only because they were seen the same time as consoles. It is also possible that, despite being seen in the same visit, there was no single hit that contained video game consoles with any of the other categories of interest. In a case like that, you won’t see your other conditions listed at all. This is the part where the logic gets a little bit difficult to follow. After Summit I actually had a very long conversation with Eric Matisoff where we talked about the logic. It took a while to fully understand what exactly is happening in the back end here.
The use cases for a segment like this can be quite niche, but in those rare instances where you need it, it’s an extremely powerful tool for you to use. You can also use this type of logic in a sequential segment such as seeing a specific page before performing a number of actions.
Using Visit-in-Hit for Sequential Segments
The great thing about that is you can use it to help clean up your tables in reporting. For example, if you only have the visit level sequential segment, and you want to return the number of page views for the home page, you would need an additional dimension field as a breakdown to get the accurate number. Typically adding an extra dimension isn’t too cumbersome, but when you have a lot of tables in a report, the more you can simply it for your business partners, the better. Also, then you don’t have to remember to always add the extra dimension breakdown (so less change for your business partners to use the segment and forget that dimension!). Having the sequential segment in a hit level segment means that you get much cleaner results a lot faster.
Building logic-bending segments is one of my favourite parts of working in Adobe Analytics. Segments really are one of the most powerful tools. There are a lot of great resources out there to help you up your segment game. In addition to my Rockstar session at Summit, there’s also a guide on Quick Segments vs the Segment Builder I published last year. There is also a series of blog posts being written by Jen Dungan that are going through all of the aspects of making segments work better for your organization. You can check out the first post in her series here.
I hope that you’ve found this helpful and informative. Be sure to come back next week for the second Tuesday Tech Byte