Comma Between Direct Quote and Attributive Tag
When quoting, it must be made clear to the reader who said (or wrote or thought) whatever is being quoted; this is done by using “attributive tags”. Look for words like he said, he claimed and according to. Attributive tags can be at the beginning or end of the quote, or even in the middle (in which case you would use a comma before and after the attributive tag). American convention generally places commas outside opening quotation marks and inside closing quotation marks.
At the end of the class the professor remarked, “How attentive you have been today!”
“There is a problem,” the head caretaker agrees, “with the storage of garbage between pickups.
“You have ice cream on your nose,” my friend snickered.
“When you leave the house,” my mother yelled, “don’t slam the door!”