Elevation losses (i.e. periods when the person is descending) are not counted or offset against this measure.
In descending from the summit to return to their start they don't have to make any other gains in elevation (i.e. it is just continuously down), so their total CAG for the journey stays at 4,000 feet (1,200 m), which is the total of vertical distance they climbed.
Now take the case of a journey where a climber travels across several summits with more "ups-and-downs".
In descending from the first summit to return to their start they don't have to make any other gains in elevation (i.e. it is just continuously down), and their total CAG for the journey stays at 10,000 feet (3,000 m).
Cumulative elevation gain can be recorded and calculated automatically using GPS devices such as Garmin or Strava.