Hook

Sub-hooks and tunnels

The most powerful part of Hook. A sub-hook is a whole question whose answer becomes a value inside another question. The tunnel is that flow. It replaces copying a result from one report into the next.

Why you would use one

Some questions have two steps: "find these people, then look at what they did". Without a sub-hook you would run one question, copy its answer, and paste it into a second. With a sub-hook it is a single question, and Hook runs it in one go.

Everything a named lead viewed
Show a list of ... values of page, of page views where visitor id is any of [sub-hook: a list of ... values of visitor id, of form submissions (leads) where name contains "hanna"].
Why it is useful: The sub-hook finds Hanna's visitor, the main hook lists the pages that visitor viewed.
Pages people spent longer on than the /pricing average
Show the number of page views where time on page more than [sub-hook: a calculation: average time on page, of page views where page is /pricing].
Why it is useful: Compares every visit with a benchmark that is itself computed from your data.

How to add one

  1. Next to any value, choose the result of a sub-hook (tunnel) instead of a value I type.
  2. A full hook builder opens inside a dashed box. Build it exactly like any other question.
  3. Look at the box border. It says Fits in green, or the reason in red.

A sub-hook can contain sub-hooks of its own. The innermost one runs first.

What fits where

Two rules decide whether a sub-hook can feed a value. Hook enforces both and never converts silently.

RuleMeaning
ShapeA sub-hook returning one value (a count or a calculation) fits any single-value comparison, such as "more than". A sub-hook returning a list fits only is any of and is none of.
TypeThe kinds must match. A list of visitor ids fits a visitor id field. A count cannot feed a duration.
  • If you used a comparison with a list, the box turns red and offers Use "is any of" instead. One click fixes it.
  • A breakdown hands over its keys. "The 5 pages with the most views" becomes a list of 5 pages.
  • Sub-hooks offer every output the main hook has: a number, a calculation, a list, values or a breakdown.

Turning a hook into a sub-hook

Sometimes you build a question and then realise it should feed a bigger one. Press Use this hook as a sub-hook... under the main hook. Your whole hook moves inside a new one, you pick where its result should flow, and Hook offers only the places it fits.

Seeing what a sub-hook did

  • The preview draws each sub-hook as a smaller figure under "Sub-hooks, flowing in through tunnels", saying which value it flows into.
  • How it ran reports what each tunnel carried: one value, or a count and the first few values.
It is fast, and the size of the list does not matter

A sub-hook runs once, inside the database. Its result never travels to your browser and back, so a tunnel carrying fifty thousand ids still costs one run. Copying and pasting a list of that size by hand would not even be possible.

This page describes Hook (query format version 3) as reviewed on 2026-10-07.