Skip to content
Advertisement

BigQuery finding sessions that have visited both pageA (contains keyword “main”) and pageB (contains keyword “side”)

On BQ I’m trying to find sessions that have visited both pageA (URL contains keyword “main”) and pageB (URL contains keyword “side”), and the pages that session visited. Here is my logic, I first wanted to find out sessions that have visited pageAs (URL contains keyword “main”), then I wanted to do a join, so to find out those sessions who have visited pageAs, what else pages on the site have they visited. Below is my query:

I am attaching an example output here:

sessionID Pagepath
123 /main-size
123 /main-size
456 /main-size
456 /main-size
456 /side-hide
456 /side-build
456 /June-event

In this case session 456 meets my condition because it has visited both page contains “main” and page contains “side”, however I wonder through this output how I can query to only get below output:

sessionID Pagepath
456 /main-size
456 /main-size
456 /side-hide
456 /side-build
456 /June-event

Advertisement

Answer

Consider below query.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement