After King Candy lied to Ralph about his reasons for not letting Vanellope race, and when she came out of Diet Cola Mountain she asked him to lower his head and close his eyes, so she could place it around his neck. When Ralph was allowed to open them again he looked at the cookie medal and saw that it said "To Stinkbrain", until Vanellope told him to turn it over to see the words "Your my Hero". She was worried that she wouldn't be able to come in first place, which would award her the winner's cup and the coins -including Ralph's medal of Hero's- in it, so Vanellope made a "backup" medal so he still could return to his home game with a medal around his neck.
Having the "hand made medal" made it harder for Ralph as he tried to stop Vanellope from racing and destroyed the kart that they had made together. When Ralph later returned home, to find everyone gone as their game is going to be unplugged because of his actions, he looked at the heart, cookie medal before throwing his golden medal away. He realized that a medal that was made from the heart is worth far more than a medal that is made out of gold. He later had it clutched in his fist as he was delivering the final punch that would turn Diet Cola Mountain into a beacon that would get rid of the Cy-Bugs and save Sugar Rush.