I was told by the nurse to get this before my pregnancy, so I had it a month or so before my IVF. I think if you don't get it before, they give it to you before you leave the hospital.
I just got it at 32 weeks at my OB's office. My OB recommends it after 20 weeks because you can pass antibodies onto your baby. I also had my husband and parents get it.
Re: vaccinations - whopping cough