Gamma-ray bursts are very rare: only one happens in a typical galaxy every few million years. The stars which cause these explosions are very massive, so the material required for them to be formed must be in great amounts. So, these explosions can be used to track down if there is a galaxy in that direction, or there is a large group of matter in there.