Stroke measures the distance between full compression of the shock and full extension. With the shock extended fully, this is also the length of the piston that is visible outside of the shock (as shown above, taking into account the limiters on the shock shaft.)
Stroke can be changed via internal shock limiters (downtravel) or external limiters (uptravel.) Stroke is used to tune a car's droop.