Hello and thank you for your question.
Melatonin is used in dogs, however I have seen it used to control anxiety, and sleeplessness.I have no experience with using it for the problem you have described.
This drug may make her sleepy so follow the dose recommended by your veterinarian.
Melatonine has no other known side effects other then the mild sedation and is considered safe.
Here is a link discussing the common uses and recommend dosage in dogs.
http://www.petplace.com/drug-library/melatonin-melatonex/page1.aspx
Please let me know if I can be of additional assistance.
Veterinary Technician
Practicing Veterinary Technician for 23 years. Veterinary Practice Owner, Technician Trainer