When Donovan was transferred to the frontline, he didn't want to risk Rags' life, so he left the little guy behind. The dog, however, wasn't having any of it, and tracked Donovan to the trenches. Realizing that the pup was good at finding his way around, Donovan adapted a secondary strategy: He taught Rags how to run messages between the command and the frontline.
"We'll just ... tuck this into your collar, shall we?"
Rags took his promotion incredibly well, regularly delivering important messages despite constant gunfire, explosions, distracting smells and other stuff custom made to lead a dog astray. He wasn't just doing his part, either -- he constantly watched and studied the things the soldiers around him did. When the men hit the dirt upon hearing a shell, Rags would mime their actions.
Then, one day, he started throwing himself to ground without any incoming noises at all. For a while, everyone around went "Awwww" and said "Look, he's trying to be human." Then, when the first explosions shook the trench, they quickly realized that dogs hear pretty well. Throughout his mimicking antics, Rags had been employing his Pavlovian powers. He now realized that the high-pitched incoming sounds equal explosions, and knew what to do. And so it came to be that the men of his unit soon found themselves imitating Rags.
They even replaced "Oh shit!" with a sort of yelping sound.
His new status as a lifesaver made Rags a celebrity. He capitalized on his fame by circling all the mess halls he could find, cashing in on his reputation for the finest wartime food available and never once returning to a hall if he felt he hadn't received a warm enough welcome there. His freewheeling antics were only limited after he got into a fight with Theodore Roosevelt Jr.'s cat, the survival of which was likely an achievement in itself.