You can measure cortisol in blood, saliva, urine, feces, or hair. We consider the blood (plasma) measurement to be the gold standard: when the adrenals release cortisol, they release it into the blood. This is the hardest to get (you have to stick a needle into the dog) and the fastest to change. Blood cortisol starts increasing only 3 minutes after the onset of a stressor. Practically, this means that since sticking a needle into a dog is likely to stress the dog, you have to complete the blood draw (probably including catching and restraining the dog, unless it is a very mellow dog) in under 3 minutes!  This can be possible to do with some dogs and impossible with others. Either way, it requires someone who is very competent at blood draws.
After cortisol is released into the blood, it diffuses into the saliva. This process takes about a minute, so you should collect the saliva less than 4 minutes after you stress the dog by restraining it.  If the dog really doesn’t mind the restraint, you can take longer, but I found that sticking things in a dog’s mouth to collect saliva tended to get them excited. In a hospital, just walking into the dog’s run got most dogs excited!
Blood and saliva are the best ways to measure the immediate response to a stressor: take a baseline measurement (in under 3-4 minutes), stress the dog, wait some period of time, then take the post-stress measurement (in under 3-4 minutes, in order to be sure you’re measuring the correct stressor). Taking a single measurement of blood or saliva is not going to tell you as much: there is no known baseline of cortisol for any species, including dogs. It varies too much hour to hour, not to mention that some individuals just start at a different level when they are unstressed. 
So take one sample before the stressor starts. After the stressor starts, how long do you wait to sample again? Definitely the same amount of time for each dog. Studies have mapped the time course of cortisol’s rise and fall after a stressor: it seems to go up for an hour or so and then come back down . This is almost certainly dependent on the stressor, of course. My personal rule of thumb is that 20 minutes is a good amount of time to wait to make sure that the cortisol levels have come up enough to be a good reflection of the dog’s reaction to the stressor you’re measuring. (So, just to be super clear: the 3-4 minute rule is just about the beginning of the rise in cortisol levels. The rise will continue for a while.)
If you are interested in how an animal is responding to a chronic stressor, like a few days or weeks in a shelter environment, you’ll be more interested in some measurement of cortisol which covers a longer time period than 20 minutes. Saliva and blood are awful for this kind of study, because their cortisol levels change so fast that you aren’t getting a good overall picture of daily cortisol level; you’re getting more of a snapshot. You could take hourly samples, but that would be difficult in terms of collection and expensive in terms of analysis.
For this kind of study, most people use urinary cortisol. Technically this is the cortisol to creatinine ratio: what is the ratio of cortisol to a standard urine molecule, creatinine? Measuring cortisol this way standardizes your measurement so that it isn’t affected by how dilute the urine is. Urinary cortisol levels will provide something like an average cortisol measurement over however long the dog has been filling up its bladder, probably about 4-6 hours. Urinary cortisol has been used as a measurement for chronic stress in shelter dogs , where you are interested in average stress levels, not an immediate stress response. (For more on measuring stress in shelter dogs using cortisol, see the excellent recent review by Hennessy. )
One interesting study looked at elevations in urinary cortisol after dogs had had a trip to a veterinary clinic . In this case, I worry that measuring a specific stressor that has a beginning and an end prior to urine collection is difficult with this method. When did the dogs start making that urine? Before they got stressed, while they were stressed, after they stopped being stressed? When you are comparing different dogs’ urinary cortisol, are you comparing the same thing?
I rarely see studies using fecal cortisol to assess stress in dogs, beyond the proof of concept study ; these studies are mostly done in wild animals, because poop is the only thing you can easily collect from them. I have always thought that fecal cortisol might actually be a really good approach to stress measurement in shelter dogs, though: easier to collect than urine, and measuring a longer period of time than urine (since dogs urinate more often than they defecate), so therefore presumably getting a better average. Today as I was looking on Mendeley for some references for this post, I encountered a new study using fecal cortisol to assess stress in cats.  Cool.
You can actually measure cortisol in hair as well! I have not seen this done in dogs. It would be a good measurement of even longer term stress levels, over months. One fascinating study measured cortisol levels in archaeological hair, to determine cortisol levels in prehistoric humans. 
So, in summary: saliva or blood are good samples to take for a response to an acute stressor, usually one you have control over. Take a sample before the stressor begins and then about 20 minutes after the stressor has begun. Be careful to take your samples very promptly to make sure you are not measuring the stress of the sampling. Urine and feces are better measurements for chronic stressors, and provide a several hour summary of what the cortisol has been doing in the dog’s blood. You can take just one sample of these to compare to your control group.
References Kobelt A.J., Hemsworth P.H., Barnett J.L. & Butler K.L. (2003). Sources of sampling variation in saliva cortisol in dogs, Research in Veterinary Science, 75 (2) 157-161. DOI: 10.1016/S0034-5288(03)00080-8
 Schatz S. & Palme R. Measurement of faecal cortisol metabolites in cats and dogs: a non-invasive method for evaluating adrenocortical function., Veterinary research communications, PMID: 11432429
 Vincent I.C. & Michell A.R. (1992). Comparison of cortisol concentrations in saliva and plasma of dogs, Research in Veterinary Science, 53 (3) 342-345. DOI: 10.1016/0034-5288(92)90137-Q
 Stephen J.M. & Ledger R.A. (2006). A longitudinal evaluation of urinary cortisol in kennelled dogs, Canis familiaris, Physiology & Behavior, 87 (5) 911-916. DOI: 10.1016/j.physbeh.2006.02.015
 Hennessy M.B. (2013). Using hypothalamic–pituitary–adrenal measures for assessing and reducing the stress of dogs in shelters: A review, Applied Animal Behaviour Science, 149 (1-4) 1-12. DOI: 10.1016/j.applanim.2013.09.004
 Vonderen I.K., Kooistra H.S. & Rijnberk A. (1998). Influence of Veterinary Care on the Urinary Corticoid: Creatinine Ratio in Dogs, Journal of Veterinary Internal Medicine, 12 (6) 431-435. DOI: 10.1111/j.1939-1676.1998.tb02146.x
 Gourkow N., LaVoy A., Dean G.A. & Phillips C.J.C. (2014). Associations of behaviour with secretory immunoglobulin A and cortisol in domestic cats during their first week in an animal shelter, Applied Animal Behaviour Science, 150 55-64. DOI: 10.1016/j.applanim.2013.11.006
 Webb E., Thomson S., Nelson A., White C., Koren G., Rieder M. & Van Uum S. (2010). Assessing individual systemic stress through cortisol analysis of archaeological hair, Journal of Archaeological Science, 37 (4) 807-812. DOI: 10.1016/j.jas.2009.11.010